I don't think it's impossible to parse. Ruby also manages to parse `p /a/m`= as regexp rather than `p / a / m`. Konstantin On Nov 6, 2011, at 17:05 , George Koehler wrote: >=20 > Issue #5478 has been updated by George Koehler. >=20 >=20 > =3Dbegin > Ruby stdlib already has Set::[], a method that creates a literal set. >=20 > irb(main):001:0> require 'set' > =3D> true > irb(main):002:0> Set[1, 2, 3] > =3D> #<Set: {1, 2, 3}> >=20 > The proposed syntax <1, 2, 3> might be impossible to parse, because it co= nflicts with < and > operators. Consider this example: >=20 > def c(*args); args.length; end >=20 > p c <1, 2, 3> > 4 >=20 > Current Ruby (with no set literal syntax) parses this example like so: >=20 > p(c() < 1, 2, (3 > > 4)) >=20 > If <1, 2, 3> became a set literal, then this example would become ambiguo= us. No parser would know whether this code has a set literal, or calls < an= d > operators. > =3Dend >=20 > ---------------------------------------- > Feature #5478: import Set into core, add syntax > http://redmine.ruby-lang.org/issues/5478 >=20 > Author: Konstantin Haase > Status: Open > Priority: Normal > Assignee:=20 > Category:=20 > Target version: 3.0 >=20 >=20 > =3Dbegin > A set is a central data structure. However, a lot of Ruby developers use = arrays for situations where it would be more reasonable to use a set. One r= eason for that is that it is way easier to use Array then Set at the moment= , another one is that developers are simply not aware it exists. >=20 > I propose moving Set from the stdlib to core and possibly add a syntax or= a method on array for creating Set literals. >=20 > First class syntax suggestions: >=20 > <1, 2, 3> # might be tricky to parse > #[1, 2, 3] # would collide with comments > $[1, 2, 3] > ${1, 2, 3} >=20 > Method suggestions: >=20 > ~[1, 2, 3] > +[1, 2, 3] >=20 > Whitespace separated String Sets could look like this: >=20 > %w<foo bar blah> # creates an array at the moment=20 > #w[foo bar blah] # would collide with comments > $w[foo bar blah] # would collide with sending :[] to $w > $w{foo bar blah} >=20 > ~%w[foo bar blah] # not really shorter than using an array with string= s > +%w[foo bar balh] # not really shorter than using an array with string= s >=20 > Maybe it's ok to not have a whitespace separated syntax, I'm just brainst= orming here. >=20 > The issue with the method approach is that it would create an Array to se= nd the message to first. >=20 > I favor the <1, 2, 3> syntax, possibly without the ability to create a wh= itespace separated version. >=20 > I'd be willing to work on a patch not only for MRI but also for JRuby and= Rubinius if you would consider this to be useful. > Although I would need help with the parser. > =3Dend >=20 >=20 >=20 > --=20 > http://redmine.ruby-lang.org >=20