--0016e64bde3250971c0471c9966e
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

On Sat, Aug 22, 2009 at 7:38 PM, Caleb Clausen <caleb / inforadical.net>wrote:

> Yehuda Katz wrote:
>
>> I'd like to propose that we add the following syntax for procs in Ruby:
>>
>>  x   contents }
>>  x   |y| contents }
>>    { contents }.should raise_error(Exception)
>>    call_method({ proc_1 }, { proc_2 }, { proc_3 })
>>  Essentially, any use of {} that was not a Hash would become a proc.
>> Effectively, this includes all use of {} that produces a SyntaxError at the
>> moment ({} remains the equivalent of Hash.new). I suggested this to
>>
>
> How do you disambiguate this case:
>
>  { foo bar baz }
>
> which could be parsed 2 ways:
>  { foo(bar) baz } #a hash
> or
>  { foo(baraz) }   #a block
>
> (Note, however, that the first snippet is currently a syntax error....)
>
> I think Rick DeNatale raises a good point too.
>
> Ruby 1.9 used to have a feature like this, but it was taken out, I think
> out of fear of the ambiguities it creates. As a user, I like this feature a
> lot. But as an implementor of ruby's syntax, I've learned to dread
> ambiguities; they just make my life hard. That's not necessarily a reason
> not to do it, but I would like the ambiguities to be very carefully
> considered and explicitly mapped out.


Right. That's why I asked @ujihisa to write the patch before I submitted the
proposal -- so we could see just how difficult it would be. I think the
patch demonstrates that the implementation isn't too bad, and I definitely
would like to see the specification mapped out. Now that we have a working
patch, we can see whether it works the way we'd expect by just trying it out
:)




-- 
Yehuda Katz
Developer | Engine Yard
(ph) 718.877.1325

--0016e64bde3250971c0471c9966e
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<br><br><div class="gmail_quote">On Sat, Aug 22, 2009 at 7:38 PM, Caleb Clausen <span dir="ltr">&lt;caleb / inforadical.net&gt;</span> wrote:<br><blockquote class="gmail_quote"tyle="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div class="im">Yehuda Katz wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I&#39;d like to propose that we add the following syntax for procs in Ruby:<br>
<br>
             
   ߱  ߲  ߳ 
                     
</blockquote>
<br></div>
How do you disambiguate this case:<br>
<br>
   ὦ<br>
which could be parsed 2 ways:<br>
     
or<br>
     <br>
(Note, however, that the first snippet is currently a syntax error....)<br>
<br>
I think Rick DeNatale raises a good point too.<br>
<br>
Ruby 1.9 used to have a feature like this, but it was taken out, I think out of fear of the ambiguities it creates. As a user, I like this feature a lot. But as an implementor of ruby&#39;s syntax, I&#39;ve learned to dread ambiguities; they just make my life hard. That&#39;s not necessarily a reason not to do it, but I would like the ambiguities to be very carefully considered and explicitly mapped out.</blockquote>

<div><br></div><div>Right. That&#39;s why I asked @ujihisa to write the patch before I submitted the proposal -- so we could see just how difficult itould be. I think the patch demonstrates that the implementation isn&#39;too bad, and I definitely would like to see the specification mapped out. Now that we have a working patch, we can see whether it works the way we&#39;d expect by just trying it out :)</div>

<div>/div></div><br><br clear="all"><br>-- <br>Yehuda Katz<br>Developer | Engine Yard<br>(ph) 718.877.1325<br>

--0016e64bde3250971c0471c9966e--