Problem with method references

Howard Lovatt howard.lovatt at gmail.com
Fri Jan 14 14:18:46 PST 2011


On 15/01/2011, at 4:35 AM, Stephen Colebourne <scolebourne at joda.org> wrote:

> On 14 January 2011 16:38, Brian Goetz <brian.goetz at oracle.com> wrote:
>>> Something like:  new#Integer(int)
>> 
>> I think we'd discussed
>> 
>>   Integer#new(int)
> 
> :-)
> 
> <tangent>
> 
> Since there is talk of keeping the ref and immediate syntaxes the
> same, perhaps we should consider adding a synonm for object
> construction:
> 
>  Integer a = new Integer(2);
>  Integer a = Integer.new(2);
> 
> I'd love to see that as it would make it much easier to discover
> whether 'new' or a factory should be used when using an IDE.
> 
>  Integer a = Integer.<ctrl-space>   -> choice of 'new' or 'valueOf'
> 
> Going even further, there could be a way to make certain factories
> used in place of 'new'.
> 
> </tangent>
> 
> Stephen

This would be great, we could also target type and write:

Integer i = new( 2 );

Unfortunately I suspect it won't happen :(


More information about the lambda-dev mailing list