Hi -- On Mon, 21 Mar 2005, Daniel Amelang wrote: > I'm really sorry if this isn't the place to talk about this. I've > already brought it up on ruby-talk, but I think ruby-core is where the > people involved in the issue are. > > I really like the new proposed syntax for proc/blocks: > > b = {|| puts "good idea"} > > But the empty pipes make it ungraceful, in my opinion. I understand > the need to differentiate between the {} syntax for blocks and the {} > syntax for hashes. Thus, I propose that instead of changing the block > syntax to resolve the ambiguity, we change the hash syntax. > > Consider the following alternative hash constructs: > > # The key value pairs completely differentiate the hash from an array, Not always: { 1,2,3,4 } # a hash [ 1,2,3,4 ] # an array > # allowing us to borrow the [] from array's constructor > hash = [name:'bill', age:25] What about this: def name(x); end [name:'bill'] # {:name => 'bill'} or [name('bill')] ? > # So what does an empty hash look like? Here's one possiblility. > hash = [:] > > If the preceding syntax were adopted, the {} braces would no longer > partially belong to hash, but entirely to blocks/procs, giving us much > needed flexibility in syntax. Actually it sounds like less flexibility and more fragility. For example, I suspect the answer to my questions above would be: commas would not be allowed as hash key/value separators any more, and whitespace would be required before a symbol argument to a method, and so on. So writing a Hash correctly would involved threading a much narrower needle. I tend to agree with Dan Berger on all of this; it seems like a solution in search of a problem. David -- David A. Black dblack / wobblini.net