Scala and Python's pass

scala

Solution

In Scala 2.10, there is the `???` method in Predef.

scala> ???
scala.NotImplementedError: an implementation is missing
  at scala.Predef$.$qmark$qmark$qmark(Predef.scala:252)
  ...

In 2.9, you can define your own one like this:

def ???[A]:A = throw new Exception("not implemented")

If you use this version without an explicit type paramter, `A` will be inferred to be `Nothing`.

Problem

I was wondering, is there an equivalent of python's pass expression? The idea is to write method signatures without implementations and compiling them just to type-check those signatures for some library prototyping. I was able to kind of simulate such behavior using this: ``` def pass[A]:A = {throw new Exception("pass"); (new Object()).asInstanceOf[A]} ``` now when i write: ``` def foo():Int = bar() def bar() = pass[Int] ``` it works(it typechecks but runtime explodes, which is fine), but my implementation doesn't feel right (for example the usage of java.lang.Object()). Is there better way to simulate such behavior?

Original source