For what it's worth (not very much) I implemented some of these in my own language (brat-lang.org).
Arrays can be like this:
[1 2 3 :a :b :c]
or use any whitespace like line breaks.
Hashes can look like this:
[a: 1 b: 2 c: 3] # I used square brackets for arrays and hashes, curly braces are reserved for methods/blocks
Method calls can looks like this:
a 1 2 :a b: 3 # like a(1, 2, :a, b => 3) in Ruby
To be honest, it's not that helpful and can get confusing. When you start adding in variable names it gets worse:
[1 a 2 3] # equivalent to [1, a(2, 3)]
a 1 b 2 3 # equivalent to a(1, b(2,3))
and so on.
I suspect this is why it's unlikely to catch on in Ruby. I also suspect it would be easier to convince Matz to add a new literal to the %w and %i family that accepts numbers that to do the comma-less syntax.
-Justin
···
On 01/09/2014 04:44 PM, Кирилл Яковлев wrote:
What if we make a cleaner syntax in some cases?
Hashes
{ a: 1
b: 2
c => e }
rather
{ a: 1,
b: 2,
c => e }
Arrays
[ 1
2
3 ]
and
[ 1 2 3 ]
rather
[ 1,
2,
3 ]