On Tue, 2 Nov 2004 00:18:50 +0900, itsme213 <itsme213 / hotmail.com> wrote:
> 
> "Robert Klemme" <bob.news / gmx.net> wrote
> > This one just stroke me: if syntax could be further relaxed without
> > introducing ambiguities then maybe we'd be able to write something like
> this
> > without other means:
> >
> > expr.ifDo { puts "true" } :elseDo { puts "nah" }
> 
> See http://rcrchive.net/rcr/show/229
> 
> 

The main problem is that internally the entire conditional (i.e. if
else or case when...) need to be treated as a single expression.
Remember this is targeted to be both a change to evaluation of Ruby
and its parser. The RCR you pointed to above could use some
clarification. I don't know about you but it made ruby look a little
too messy of confusing. I am open to suggestions about syntax and if
any of you have thoughts please post them. I was , for now, looking at
taking current conditionals and converting their parts to block that
would be called. This is a problem with 2.0 block local vars. Any
thoughts on that would also be great :) . Last but not least. If a
conditional is passed a block it will call the block and not be
expected to have anything else. There may be a better way for us to
represent these conditionally executed blocks. For local blocks we
could speed up execution by in lining them and paying attention to
block locality before and after. This gets rid of a few calls.

Then there is still the possibility that we do not use blocks at all.
I am against this as I don't mind a block introducing new scope but
there may be other thoughts here too. The new scope is found with just
about everything else in Ruby so it makes for consistency (i.e. def
creates a new scope -- and hopefully will return something usefully in
the future).

Brian Mitchell.