??? is really useful, particularly as a method stub or end of method stub.
It could however be more useful. I can think of two ways:
Give it a type hint:
def ???[A]: A = throw new NotImplementedError
That could help with giving type hints that can aid in inference, for example when ??? is used as a parameter to a function requiring multiple type parameters. It’s not a big thing, but it seems to me to be strictly more useful than the current ???
2.Give it a brother that is a function:
def ????[A](swallow: Any*): A = throw new NotImplementedError
This is useful for swallowing any unused parameters or values in your stub, without them leaking in to warnings about unused parameters.
def toBeImplemented(a: Int, b: Double): String = ????(a, b)
of course, you sometimes want to do that later as well
IMO every ??? should be a warning, so you don’t forget them. ??? is great
for “hole-oriented programming,” meaning you can leave unfinished “holes”,
sketch out the rest of the code, and come back), but you do need to fill in
the holes eventually. And if you use ???, you are ignoring some
No one said the unused parameter warning is warning for the ???. What I
meant is that if you’re using ???, the last thing you should be complaining
about is that the compiler notices you’re ignoring your parameters. The
compiler is right to warn you. If anything it should have more warnings,
I can see why it might cause problems for someone who configures their
build to fail on warnings. Hopefully at least that wouldn’t prevent it from
showing actual errors.
def f(x: Int): Int = macro ???? // macro impl can warn if f is used
def f(x: Int): Int = ???? // or warn that f is not implemented
A macro can also optionally emit a warning; it’s possibly a feature that the warning would be emitted only if the method is used. The macro could also obey a flag like @ elidable, or rewrite to an elidable method.