[#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 12:55:38 UTC
List: ruby-core #4630
Hi --

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

> On Sunday 20 March 2005 21:31, Daniel Amelang wrote:
>> I really like the new proposed syntax for proc/blocks:
>
> Ditto.
>
>> Consider the following alternative hash constructs:
>>
>> # The key value pairs completely differentiate the hash from an array,
>> # allowing us to borrow the [] from array's constructor
>> hash = [name:'bill', age:25]
>
> This reduces the number of keystrokes for creating hashes and is no less clear
> or parseable, so is fine by me.

I find the visual reliance on the : separator as an indicator of
constructor behavior obscure and fragile.  But also, in more practical
terms, I wonder what would happen to something like:

    a = SomeClass.new
    b = 100

    { a => "apple", b => "orange" }

It couldn't be [a:'apple', b:'orange'], of course.  I think that means
there would have to be another literal hash constructor for hashes
whose keys were not symbols, or some other workaround or special-case
(which it actually isn't) expression.

All of this just seems like so much upheaval to avoid the
(comparatively unusual [compared to hash literals, that is]) keyword
'lambda'.


David

-- 
David A. Black
dblack@wobblini.net

In This Thread