title: How to access object with "creative" names in scala?
body: <p>For example, given</p>
  
  <pre><code>object ~ {
     def foo = ???
  }
  </code></pre>
  
  <p>How do i access that method?</p>
  
  <p>Neither of those work:</p>
  
  <pre><code>~.foo  
  
  `~`.foo
  </code></pre>
  
  <p>With both the compiler complains about "illegal start of simple expression".</p>
  
  <p>And yes, i know i probably shouldn't name classes "~" but both the standard library and some other libraries do, and sometimes you need to work with them.</p>
  
  <p>Added: Looking at <a href="https://stackoverflow.com/a/40527103/130019">sschaef's answer</a> i tried </p>
  
  <pre><code> $tilde.foo
  </code></pre>
  
  <p>And that actually works. Not sure if that's intended or just an implementation detail of how those names are translated to JVM-identifiers. And whether that would work in other flavors of scala (e.g. Scala.js)?</p>
  
  <p>I'll leave this open for a bit to see maybe someone chimes in with a more extensive answer.</p>