[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

append_features vs include

Rob Sanheim

10/6/2006 1:06:00 AM

I've read somewhere that Module#append_features is the old name for
this method, and "included" should be used going forward. Makes sense
to me, as "included" is shorter and fits the method better, anyways.

So is "append_features" going to be removed at some point, maybe 2.0?
I don't see it as really buying us anything, as its not a "humane"
alias like length vs size are for Array.

Rob
--
http://www.robs...
http://www.seekin...
http://www.a...

3 Answers

Logan Capaldo

10/6/2006 1:21:00 AM

0

On Fri, Oct 06, 2006 at 10:06:12AM +0900, Rob Sanheim wrote:
> I've read somewhere that Module#append_features is the old name for
> this method, and "included" should be used going forward. Makes sense
> to me, as "included" is shorter and fits the method better, anyways.
>
> So is "append_features" going to be removed at some point, maybe 2.0?
> I don't see it as really buying us anything, as its not a "humane"
> alias like length vs size are for Array.
>
It's not an alias at all. (Hence why using append_features is that much
more work than included) It's the method that does the actual appeneding
of the features of the modules into the class or module that it gets
included into. It is in other words, an implementation detail. included
on the other hand is a callback that gets called after all this nitty
gritty detail stuff is finished, for the express purpose of allowing
custom code to be hooked into the inclusion process.
> Rob
> --
> http://www.robs...
> http://www.seekin...
> http://www.a...

Rob Sanheim

10/6/2006 4:39:00 AM

0

On 10/5/06, Logan Capaldo <logancapaldo@gmail.com> wrote:
> On Fri, Oct 06, 2006 at 10:06:12AM +0900, Rob Sanheim wrote:
> > I've read somewhere that Module#append_features is the old name for
> > this method, and "included" should be used going forward. Makes sense
> > to me, as "included" is shorter and fits the method better, anyways.
> >
> > So is "append_features" going to be removed at some point, maybe 2.0?
> > I don't see it as really buying us anything, as its not a "humane"
> > alias like length vs size are for Array.
> >
> It's not an alias at all. (Hence why using append_features is that much
> more work than included) It's the method that does the actual appeneding
> of the features of the modules into the class or module that it gets
> included into. It is in other words, an implementation detail. included
> on the other hand is a callback that gets called after all this nitty
> gritty detail stuff is finished, for the express purpose of allowing
> custom code to be hooked into the inclusion process.

Okay, where I said "included" in the above post I meant "include".
Sorry about that.

And now that I look at the rdoc, it looks like the only difference is
that include allows multiple arguments, whereas append_features takes
one arg only.

So I guess the question I really want to ask is this: why not just
have include fold append_features in to it?

- Rob
--
http://www.robs...
http://www.seekin...
http://www.a...

Yukihiro Matsumoto

10/6/2006 4:44:00 AM

0

Hi,

In message "Re: append_features vs include"
on Fri, 6 Oct 2006 13:38:53 +0900, "Rob Sanheim" <rsanheim@gmail.com> writes:

|So I guess the question I really want to ask is this: why not just
|have include fold append_features in to it?

I wanted hooks in both ways, i.e. redefining "include" makes a hook
from the destination, and redefining "append_feature" makes a hook
from the source. "included" is more handy for the purpose, but I am
not sure I am going to remove "append_feature", since it has more
control flexibility of hook timing.

matz.