From: "Sean E. Russell" Date: 2005-03-30T21:52:41+09:00 Subject: Re: New block syntax --nextPart2524959.7re9pKs0lf Content-Type: text/plain; charset="utf-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 =3D> 'bill'} or [name('bill')] ? irb(main):001:0> def name(x); end =3D> 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= =20 use the comma-separated constructor, but it *is* a significant syntax chang= e. > 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=20 symbol argument, AFAIK. Are you looking at a different version of Ruby tha= n=20 I am? EG: [name(:foo)] [name :foo] # [name(:foo)] ['name': 'foo'] # { 'name' =3D> '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= =20 terse syntax. Ruby has always played it fast and loose. This syntax isn't= =20 more obfuscated; it is still clear what is being meant with: h =3D [ one: 'me', two: 'you', something: 'else' ] Well, at least, to me this seems pretty natural, and much easier to type th= an=20 hashes defined with =3D>, and much clearer than hashes defined with ','. W= ith=20 long comma-separated hashes, it can be difficult to associate keys with=20 values; this syntax is more clear. =2D-=20 =2D-- SER "As democracy is perfected, the office of president represents,=20 more and more closely, the inner soul of the people. On some=20 great and glorious day the plain folks of the land will reach=20 their heart's desire at last and the White House will be adorned=20 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= =mmps -----END PGP SIGNATURE----- --nextPart2524959.7re9pKs0lf--