list literal gotcha and suggestion

Reinier Zwitserloot reinier at
Tue Sep 29 01:19:05 PDT 2009

Scanning my codebase, they are quite rare. As the set literals are  
causing rather a lot of pain, let's see some proof before going too  
far down this road.

Pain caused by set literals:

  - ambiguity of {} - is that the empty set or the empty map?
  - set/list confusion.
  - the parser becomes quite a bit more complicated to handle the  
difference between sets and maps.

  --Reinier Zwitserloot

On 2009/29/09, at 10:02, Mark Thornton wrote:

> Reinier Zwitserloot wrote:
>> new HashSet<>(["a", "b", "c"]);
>> is too much effort in the rare cases where you need to initialize a  
>> set-typed parameter? This is java, not perl. Golfing isn't the end  
>> goal.
> Without scanning my codebase I wouldn't expect Set parameters and  
> fields to be rare. I use Set's quite frequently.
> Mark Thornton

More information about the coin-dev mailing list