[#4595] New block syntax — Daniel Amelang <daniel.amelang@...>

I'm really sorry if this isn't the place to talk about this. I've

25 messages 2005/03/21
[#4606] Re: New block syntax — "David A. Black" <dblack@...> 2005/03/21

Hi --

[#4629] Re: New block syntax — "Sean E. Russell" <ser@...> 2005/03/30

On Monday 21 March 2005 16:17, David A. Black wrote:

[#4648] about REXML::Encoding — speakillof <speakillof@...>

Hi.

15 messages 2005/03/31
[#4659] Re: about REXML::Encoding — "Sean E. Russell" <ser@...> 2005/04/04

On Thursday 31 March 2005 09:44, speakillof wrote:

Re: New block syntax

From: "David A. Black" <dblack@...>
Date: 2005-03-30 13:04:52 UTC
List: ruby-core #4631
Hi --

On Wed, 30 Mar 2005, Sean E. Russell wrote:

> On Monday 21 March 2005 16:17, David A. Black wrote:
>
>> 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?

Possibly.

   $ ruby -ve 'def x(y); p y; end; x:a'
   ruby 1.8.2 (2004-12-25) [i686-linux]
   :a

(It may have changed in one or more 1.9's, but I'm treating it, like
all of this, as in flux and under discussion.)

>> 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.

I don't quite follow.

> 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.

Except for the [] part :-)  That's the thing: I'm really talking about
the {} constructor, and the implications of pressing [] into service
as a part-time hash literal.  I don't feel strongly about the commas,
except that for tests it's nice to type h = { 1,2,3,4 }, since it's
fast.


David

-- 
David A. Black
dblack@wobblini.net

In This Thread