[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: More flexible inheritance

Yukihiro Matsumoto

2/22/2007 2:01:00 AM

Hi,

In message "Re: More flexible inheritance"
on Thu, 22 Feb 2007 02:43:14 +0900, "Trans" <transfire@gmail.com> writes:

|On Feb 19, 3:04 am, Yukihiro Matsumoto <m...@ruby-lang.org> wrote:
|
|> What is the benefit of by this change?
|
|The benifits are more robust means of extension b/c
|
| 1) mixins can be used for extensions
| 2) mixins are much more flexible and elegant than open/alias/redefine
| 3) no longer need to fuss with alias names or method binding
| 4) we would no longer require alias (which is a keyword)
| 5) lends itself to future possiblities such as uninclude
| 6) promotes better design and way of thinking whereby
| a class is a collection of "bahaviors" (sub your prefered term)

I think I get the picture .. gradually. Interesting.
Can you be more specific about the suggestion, for example, for the
code

class Foo < Object
def foo
end
end

class Foo
def bar
end
end

what would happen? Can we access appending anonymous mixin module?

|another topic worth consideration, but selector namespaces are a
|different animal I think --well, unless we can dynamically activate
|and deactive the mixin modules depedning on the namespace we're in,
|then namespaces could be based on these. Hmm...that's a cool idea, but
|I suspect it would require a major overhaul in how Ruby works under
|the hood.

Sure it is. But I suspect this proposal is nearly as huge as selector
namespace for language change, although implementation is far easier.

matz.