This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.

--1926193751-1665424965-11936034699291
Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed
Content-Transfer-Encoding: QUOTED-PRINTABLE

Hi --

On Mon, 29 Oct 2007, david / davidflanagan.com wrote:

> [UTF-8] Wolfgang N√°dasi-Donner writes: 
>> Please, please, please...-...don't change the syntax that
>> "Ruby" and "irb" don't accept the same things, or have different
>> syntactical elements for the same thing! 
>> Wolfgang NŠŇasi-Donner
>
> First, as the person who started this thread, I'd like to point out that Matz 
> has not actually asked any of us what we think about this new feature. 
> The only objection I've heard to it that was mostly a matter of subjective 
> dislike for fluent APIs is this issue about irb. 
> I think it is solvable. (Though I don't think it needs to be solved in 1.9.1. 
> We can wait for 1.9.2...) 
> Modify IRB so that when it sees an expression that begins with a ., it treats 
> it as method invocation on the value returned by the last line.   A session 
> might look something like this: 
>> "hello"
> => "hello"
>> .upcase
> => "HELLO"
>> .reverse
> => "OLLEH" 
> The only tricky part that I see (there may be others) occurs when there is an 
> assignment expression involved: 
>> a = "hello"
> => "hello"
>> .upcase
> => "HELLO"   # What is the value of a? 
> To solve this, I think that IRB would have to defer the evaluation of 
> assignment expressions until it knows that the next line will not be a 
> continuation.  If the next line does not begin with a dot then the assignment 
> will be done before that line is evaluated.  So if the next line uses the 
> lvalue, that lvalue will have its proper value.  Seems like this would be 
> transparent. 
> If the lvalue is an attribute accessor with side effects visible outside of 
> IRB (setting the attribute is supposed to cause a file to be created, for 
> example) then there may be problems and using a semicolon would be necessary, 
> I suppose.

This seems like an awful lot of hoops to jump through, just so that
one rather specialized stylistic thing can have full sway.

I think that's what bothers me about this whole dot thing: it's a
concession on the part of the language to one use case. It strikes me
as a solution in search of a problem.


David

-- 
Upcoming training by David A. Black/Ruby Power and Light, LLC:
   * Advancing With Rails, Edison, NJ, November 6-9
   * Advancing With Rails, Berlin, Germany, November 19-22
   * Intro to Rails, London, UK, December 3-6 (by Skills Matter)
See http://www.rubypal.com for details!
--1926193751-1665424965-11936034699291--