John Joyce wrote, On 5/15/2007 4:21 PM:
>
> On May 15, 2007, at 4:55 AM, Mike Hamilton wrote:
>
>>
>> I have to wonder what exactly the benefit of having control structures
>> as objects would be? The bottom line effectiveness of any language
>> relates to what one can accomplish with it and how efficiently said task
>> can be accomplished. Under what circumstance would overriding the "if"
>> method be beneficial? Not to mention the fact that since Ruby provides
>> the ability to override things like operators and more functional
>> components (that can be more logically represented as objects), then why
>> would the lack of control structure object orientation make Ruby less of
>> an OO language? Not to mention the kind of trouble that one could easily
>> get into attempting to override control structures.
>>
>> --Posted via http://www.ruby-forum.com/.
>>
> Hmm... there could be some bizarre and interesting possibilities.
> For example, instead of if,
> why not a construct called 'perhaps' or 'maybe' to include randomness 
> or other interesting side-effects.
> Or even 'occasionally' or 'usually' for weighted randomness.
> Adverbs could make very interesting control structures, which could of 
> course be def'd more (or less) precisely.
> Imagine the expressive possibilities of:  often, quickly, slowly, 
> monthly, quarterly, hourly, randomly, quietly, obsequiously, 
> obscenely, derisively, politely, privately, publicly, etc...
> 'unless' could be 'other_than' or 'except_if'
> 'if' itself could be semantically described as the same as 'when' in 
> many human languages.
> Rather than simply being declarative like java keywords, many 
> constructs could become more descriptive.
> This is one of Ruby's biggest strengths, its expressiveness in a very 
> natural way.
>
> Once it has got the native unicode thing happening, it will be 
> possible to begin to write Ruby in languages other than English!
> Even in Japanese (which would by its grammar, make a very good 
> programming language)
>
> Some abstraction is bad because it continues to slow things down, but 
> processing power is still increasing, while human limits are pretty 
> constant.

I like this idea.  I was thinking

when a==1 someCode

is quite easy, but we need infix on methods to do

somecode when a==1

This isn't the first time I've wished we could have methods acting as 
infix operators.  Anyone else up for that, and are there any plans to 
add it to Ruby?  Assuming there is a way to do it that wouldn't muck up 
everything else syntactically, would such a feature be desired and have 
a possibility of being accepted into the language if someone were to 
code it?

Regards,
Sam