[#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-31 01:55:10 UTC
List: ruby-core #4634
Hi --

On Thu, 31 Mar 2005, Daniel Amelang wrote:

> you've brought up are not a part of the proposed new hash syntax ([:],
> etc), but part of the new hash construct already in 1.9. I addressed
> one of those concerns in an email I sent to this list last week:
>
> http://ruby-talk.org/cgi-bin/scat.rb/ruby/ruby-core/4614
>
> But I see another misunderstanding now. Forget the whole [hash] idea
> for the moment and let's just use the current 1.9 {key:value} syntax
> (with the {}, you notice). You're example:
>
> a = SomeClass.new
> b = 100
>
> {a:'apple', b:'orange'}
>
> would give you {:a=>'apple', :b=>'orange'}. If you want the 'a' and
> 'b' to refer to the _objects_ that 'a' and 'b' refer to, not the
> symbols :a and :b, you can't use the ':' syntax, you have to fall back
> on the => syntax. That has been a part of 1.9 for a while now (AFAIK).
>
>> All of this just seems like so much upheaval to avoid the
>> (comparatively unusual [compared to hash literals, that is]) keyword
>> 'lambda'.
>
> Actually, so far, your points have been against the {:} syntax, which
> has it's origins far before the whole no-lambda proc syntax idea.

You're right that we're talking about multiple things at the same
time -- it's kind of a ring of subtopics --  but actually I don't mind
the { a:b } thing itself (and thanks for clarifying the :x vs. x =>
situation).  The upheaval I'm referring to is the suggestion of having
array literals and hash literals both use [], and being able to tell
what the object is only by visually inspecting the punctuation used to
separate the elements inside.  That's what strikes me as fragile and
ad hoc.  And as I understand it, it's being suggested solely for the
sake of making {} available to be a literal lambda constructor; that's
why I make that connection.

I prefer that the constructor (and the person reading the code from
left to right) know what it's doing as soon as its leftmost token
appears.


David

-- 
David A. Black
dblack@wobblini.net

In This Thread