list literal gotcha and suggestion

Ola Bini ola.bini at
Thu Oct 8 01:09:17 PDT 2009

Kai Kunstmann wrote:
> Am Mittwoch, den 07.10.2009, 17:46 -0700 schrieb Lawrence Kesteloot:
>>> Seems like all sorts of configuration/static data/quick and
>>> dirty/unittest/mock/etc types of syntax would benefit.
>> That search returns 800 files out of a total of 11,300,000. That's one
>> file in 14,125, or 0.007%.
>> I would be against a feature which (1) has such an unclear correct
>> specification; (2) provides so little advantage over a static
>> ArrayList.of() and HashSet.of(); and (3) helps only one file in
>> 14,125.
>> On the other hand, the idea (proposed twice in this discussion) of
>> have a pair literal seems much more widely useful, and would allow
>> HashMap.of().
> A struct-like tuple literal of any arbitrary (immutable) size would
> cover even more use-cases, e.g. multiple return values in methods.

Not necessarily. Tuples are generally not iteratable (Python being the 
exception). Also they don't actually match Collection<T> since they have 
several different types. Tuples doesn't really solve any of the 
problems, and they would have to have different semantics than existing 
collections, which means larger incisions in the language.

  Ola Bini (
  Ioke creator (
  JRuby Core Developer (
  Developer, ThoughtWorks Studios (
  Practical JRuby on Rails (

  "Yields falsehood when quined" yields falsehood when quined.

More information about the coin-dev mailing list