What is Ceylon's idiom for indicating that a function is not implemented? I often want to see if a design will typecheck before going through the trouble of implementing all the functions. Presumably, this means having the body throw an error, which has type Nothing
and can be assigned to any function. This is also useful for sharing example code when the implementation does not matter.
It looks like some people use UnsupportedOperationException from Java like this:
Integer add(Integer a, Integer b) {throw UnsupportedOperationException();}
But that is too verbose to tack onto a bunch of class methods. I am looking for something similar to Scala's cutely named ???
as in:
def add(a: Int, b: Int): Int = ???
Actually, nothing
is a built-in top-level getter you can invoke:
Integer add(Integer a, Integer b) => nothing;
It may look like an object being returned, but it actually throws a runtime exception as soon it is reached.