PRE-PROPOSAL: Extension methods
reinier at zwitserloot.com
Wed Mar 18 13:28:46 PDT 2009
I don't think that's a relevant question.
import static java.util.Collections.sort;
List foo = something();
That last line gets rewritten to:
whether or not 'foo' is null does not change that rewrite. It's up the
sort method to react to the null. For consistency you could claim its
better that the runtime makes an explicit nullcheck here, I guess. But
then you'd be inconsistent with the desugaring to a static method call.
On Mar 18, 2009, at 21:05, Mark Mahieu wrote:
> 2009/3/18 Neal Gafter <neal at gafter.com>
>> When an extension method has been statically imported, you can use it
>> as if it is a member of the type of its first argument.
> Just out of curiosity, what do you think the behaviour should be
> when the
> 'first argument' is null? Put another way, from your experience
> would the
> model chosen here for C# be the right choice for Java?
More information about the coin-dev