Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>scalap to the rescue!</p> <p>I took this code:</p> <pre><code>object TestThing extends App { def one { println("one") } def two[T] { println("two") } def three[T : Manifest] { println("three") } def four[T: Manifest, U : Manifest] { println("four") } } </code></pre> <p>and ran it through scalap. Here's what I got:</p> <pre><code>object TestThing extends java.lang.Object with scala.App with scala.ScalaObject { def this() = { /* compiled code */ } def one : scala.Unit = { /* compiled code */ } def two[T] : scala.Unit = { /* compiled code */ } def three[T](implicit evidence$1 : scala.Predef.Manifest[T]) : scala.Unit = { /* compiled code */ } def four[T, U](implicit evidence$2 : scala.Predef.Manifest[T], evidence$3 : scala.Predef.Manifest[U]) : scala.Unit = { /* compiled code */ } } </code></pre> <p>As you can see, the first implicit Manifest is called <code>evidence$1</code>. The second and third—<strong>though in a different scope!</strong>—are called <code>evidence$2</code> and <code>evidence$3</code>. So... that's how you make reference to Manifests.</p> <p>Despite that, though, it seems a bit scary to me that removing a Manifest that is higher up in the class will change the name of a Manifest that is located lower in the file. Similarly, it also doesn't help that the IntelliJ Scala plugin's syntax highlighting seems to think that the Manifest variables in scope in <code>four()</code> are <code>evidence$1</code> and <code>evidence$2</code>, and it doesn't think that <code>evidence$3</code> is a valid variable there (even though it is, and <code>evidence$1</code> is not). Overall, maybe these things should be heeded as warning signs about playing with implicit Manifest variables?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload