From: Jean-Hugues ROBERT Date: 2002-04-24T07:24:15+09:00 Subject: Re: Ruby as Smalltalk Hi (small variation) At 23:23 23/04/2002 +0900, Paul Brannan wrote: >On Tue, Apr 23, 2002 at 05:18:56PM +0900, Jean-Hugues ROBERT wrote: > > Is the "," really necessary or could "} {" be considered equivalent to > "},{" ? > > > > With do/end: > > obj.meth do > > # first block > > end do > > # second block > > end > >Would this be equivalent to: > > obj.meth({ > # first block > }) do > # second block > end > >or: > > obj.meth({ > # first block > },{ > # second block > }) > >Paul The later. Basically }{ (on the same line) would be equivalent to },{. I am not exactly advocating for context dependent parser, yet they are great when sensible decisions are made about what the most common usage is. It is DoWhatIWant versus DoWhatIMeant. For the former case I would assume that a }.{ would do the job. "." would mean "do something on what is before". In this case run the block with a single argument whose value is the result of the evaluation of the previous block *or* invoke the "do()" method on the object preceding this later block: {xxx}.{zzz} => either (zzz).call( proc( zzz, result of zzz) where result of zzz block's evaluation becomes first arg to the block *or* {xxx}.{zzz} => (xxx).do( proc {zzz})) where "do()" has to be defined by the object resulting from the evaluation of (xxx). I would need more thinking more to decide on which is the better (".do()" seems slightly less "direct", hence less preferable than calling the later block with the former block's result as a parameter). Adding the ability to overload a will be "." operator would be another possibility. Anyways, in the context, I was just questioning the necessity of a "," separator when it is obvious that a separation is occurring. Very similar to avoiding the ";" that most language use when actually LF is a decent separator in most cases. As a result, I feel that },{ could be treated like }{ very much in the same spirit as LF is treated as a separator. But I guess there could be some corner cases that I overlooked. Jean-Hugues