Method reference double-colon syntax

Alex Blewitt alex.blewitt at gmail.com
Wed May 30 23:50:40 PDT 2012


On 31 May 2012, at 03:43, Brian Goetz <brian.goetz at oracle.com> wrote:

> For example:
> 
> #[ 1, 2, 3 ]                          // Array, list, set
> #{ "foo" : "bar", "blah" : "wooga" }  // Map literals
> #/(\d+)$/                             // Regex
> #(a, b)                               // Tuple
> #(a: 3, b: 4)                         // Record
> #"There are {foo.size()} foos"        // String literal

I'm sure it was noted when these considerations were given, but Objective-C recently added map and array literals 

 http://stackoverflow.com/questions/9693647/is-there-some-literal-dictionary-or-array-syntax-in-objective-c

Their syntax uses @{} and @[] for the prefix character (though objc has a history of @ precluding these specific use cases). I suspect the same could work for Java as well, and with objc's growing popularity this might be a good synergistic use. 

I for one preferred the hash (#) since I'm one of the few Java developers that uses it for JavaDoc. 

Alex


More information about the lambda-dev mailing list