Annoying inconsistency

There is an inspection "Redundant Unit result type annotation" that
detects "unnecessary" declarations that a method returns Unit.

On the other hand, when using the "Implements methods" command for a
virtual method, if the method is NOT explicitly declared as returning
Unit then the default implementation is "= null". If the method IS
explicitly declared as returning Unit then the default implementation is
the much more appropriate "{}".

Admittedly, this is mostly something that will probably only both folks
that are newish to Scala.

So, should I have to explicitly declare the method as returning "Unit"
or shouldn't I? The current implementation appears to be not only
inconsistent, but almost guaranteed to cause some confusion with newbies.

Or am I wrong and just don't yet understand why?

Donald

2 comments
Comment actions Permalink

I'll fix it. I think "Implements methods" feature shoud do it without explicit "Unit", and it will be consistent with appropriate inspection.

Best regards,
Alexander Podkhalyuzin.

0
Comment actions Permalink

Thank you!

On 3/2/12 11:00 AM, Alexander Podkhalyuzin wrote:

I'll fix it. I think "Implements methods" feature shoud do it without explicit "Unit", and it will be consistent with appropriate inspection.


0

Please sign in to leave a comment.