--nextPart2524959.7re9pKs0lf Content-Type: text/plain; charset tf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Monday 21 March 2005 16:17, David A. Black wrote: > What about this: > > def name(x); end > > [name:'bill'] # {:name => 'bill'} or [name('bill')] ? irb(main):001:0> def name(x); end => nil irb(main):002:0> [name:5] SyntaxError: compile error (irb):2: syntax error [name:5] ^ from (irb):2 irb(main):003:0> name:5 SyntaxError: compile error (irb):3: syntax error from (irb):3 Where are you seeing a problem? > 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 Yeah, that's what he proposed; personally, I don't much mind it, as I never use the comma-separated constructor, but it *is* a significant syntax change. > whitespace would be required before a symbol argument to a method, and Isn't it already? Whitespace, or a token character, is required before a symbol argument, AFAIK. Are you looking at a different version of Ruby than I am? EG: [name(:foo)] [name :foo] # [name(:foo)] ['name': 'foo'] # { 'name' => 'foo' } [name: 'foo'] # ditto Anti-symbols :-) > so on. So writing a Hash correctly would involved threading a much > narrower needle. Any reduction of typing does this, but that isn't an argument for having a terse syntax. Ruby has always played it fast and loose. This syntax isn't more obfuscated; it is still clear what is being meant with: h = [ one: 'me', two: 'you', something: 'else' ] Well, at least, to me this seems pretty natural, and much easier to type than hashes defined with =>, and much clearer than hashes defined with ','. With long comma-separated hashes, it can be difficult to associate keys with values; this syntax is more clear. -- --- SER "As democracy is perfected, the office of president represents, more and more closely, the inner soul of the people. On some great and glorious day the plain folks of the land will reach their heart's desire at last and the White House will be adorned by a downright moron." - H.L. Mencken (1880 - 1956) --nextPart2524959.7re9pKs0lf Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1-ecc0.1.6 (GNU/Linux) iD8DBQBCSlplP0KxygnleI8RAgKTAJ9MCVAUeCwDOwzNw27IzdEdIng4swCeKgPg MR+VBcOqILs5b/REbY4pu7o ps -----END PGP SIGNATURE----- --nextPart2524959.7re9pKs0lf--