Hi,

2010/11/26 Yusuke ENDOH <mame / tsg.ne.jp>:
>>>  
>>>  
>>> ..
>>>  
>>>
>>> (equivalent to)
>>>
>>>  
>>>    >>> ..
>>>  
>>
>> Could you tell me why you need this feature?
>
> Because it requires less indentation, I thought.

I see.  refine without blocks looks confusing for me because it works
different from refine with a block.

> But I found out that it has a problem of [ruby-core:33386] (1)...

I think the above code should work because the refinement of Foo is
enabled in FooExt.
It may be a bug.

>>>> I don't think we need new keywords even if it is a big change,
>>>> because some essential features such as module inclusion
>>>> have no keyword in Ruby.
>>>
>>> Indeed.     >>> code block (such as class/module definition, method definition
>>> and control statements) have their special keywords.
>>
>> I guess that most of these constructs have reasons why they need
>> keywords and special syntax.
>
> I don't think so. class Foo; end" can be written as "Foo =
> Class.new { }" (though there are indeed subtle differences between
> them).

"refine Foo do end" is different from "Foo = Class.new {}" because
"refine Foo do end" looks good, but "Foo = Class.new {}" doesn't.
I think how it looks is more important than whether it uses keywords or not.

>> If refine is a keyword, there is one good thing.   
>> after class names.
>>
>>  
>> ..
>>  
>
> The API design that "def" statements are put in a Ruby's block,
> is slightly weird (for me).      
> such a style in Ruby's embedded featues, except meta programming
> (such as Class.new and class_eval).
> From now on, does Ruby encourage such a style in casual use?

I think Module#refine is a meta programming feature like class_eval,
and most application programmers need not use it directly.
And, "refine Foo do end" looks not so bad, so I think the new keyword
refine has more cons than pros.

-- 
Shugo Maeda