Professional Web Applications Themes

OT: Traits - Ruby

All, I came across this article recently: http://www.cse.ogi.edu/~black/publications/TR_CSE_02-012.pdf Since I haven't seen a full discussion on the topic, I thought I would see what Ruby programmers think of "traits" as an OO concept. Cool idea? Or a solution in need of a problem? Regards, Dan PS - Sorry if this is a double post. Emails sent from my home and work account don't appear to be making it to the list. This was posted via Google Groups....

  1. #1

    Default OT: Traits

    All,

    I came across this article recently:
    http://www.cse.ogi.edu/~black/publications/TR_CSE_02-012.pdf

    Since I haven't seen a full discussion on the topic, I thought I would
    see what Ruby programmers think of "traits" as an OO concept. Cool
    idea? Or a solution in need of a problem?

    Regards,

    Dan

    PS - Sorry if this is a double post. Emails sent from my home and
    work account don't appear to be making it to the list. This was
    posted via Google Groups.
    Daniel Guest

  2. #2

    Default Re: OT: Traits

    Hi,

    In message "OT: Traits"
    on 04/02/14, Daniel Berger <com> writes:

    |Since I haven't seen a full discussion on the topic, I thought I would
    |see what Ruby programmers think of "traits" as an OO concept. Cool
    |idea? Or a solution in need of a problem?

    "module" in Ruby and "trait" are very similar idea.

    matz.


    Yukihiro Guest

  3. #3

    Default Re: OT: Traits

    In article <google.com>,
    Daniel Berger <com> wrote: 

    OGI is in my neighborhood. :)

    I found this interesting quote on the first page:

    "Despite the passage of nearly twenty years, neither multiple inheritance
    nor mixins have acheived wide acceptance"

    Well, I can see why multiple inheritance has fallen out of favor, but I
    use mixins all the time.

    Phil
    Phil Guest

  4. #4

    Default Re: OT: Traits

    org (Yukihiro Matsumoto) wrote in message news:<netlab.jp>... 

    Yes, I thought so, too. Their argument against mixins boiled down to
    "What if you have identical methods in two different modules that you
    wish to 'include'?". But, so far that just hasn't happened in my
    personal experience.

    Dan
    Daniel Guest

  5. #5

    Default Re: OT: Traits

    il 13 Feb 2004 08:13:07 -0800, com (Daniel Berger) ha
    scritto::
     


    just found this:
    http://homepages.ihug.com.au/~naseby/33.html
    I wonder why the author did not post a message here, I hope he does'nt
    bother if I do :)

    PS
    I'd like to remind you: if you have a weblog please subscribe
    artima.com's ruby buzz, it's cool :)
    gabriele Guest

  6. #6

    Default Re: OT: Traits

    gabriele renzi <yahoo.it> wrote in message news:<com>... 
    >
    >
    > just found this:
    > http://homepages.ihug.com.au/~naseby/33.html
    > I wonder why the author did not post a message here, I hope he does'nt
    > bother if I do :)[/ref]

    Actually, he did post to the mailing list (I can see it in the
    archive) but it didn't show up in the newsgroup for some reason. Odd.

    Dan
    Daniel Guest

  7. #7

    Default Gateway again [was Re: OT: Traits]


    "Daniel Berger" <com> schrieb im Newsbeitrag
    news:google.com... 
    news:<com>... [/ref][/ref]
    would 
    > >
    > >
    > > just found this:
    > > http://homepages.ihug.com.au/~naseby/33.html
    > > I wonder why the author did not post a message here, I hope he does'nt
    > > bother if I do :)[/ref]
    >
    > Actually, he did post to the mailing list (I can see it in the
    > archive) but it didn't show up in the newsgroup for some reason. Odd.
    >
    > Dan[/ref]

    This explains my impression that message traffic has dropped since two or
    three weeks. (I'm reading news only.)

    Does someone take action on this already? Thx!

    Regards

    robert

    Robert Guest

  8. #8

    Default Re: OT: Traits


    "Daniel Berger" <com> schrieb im Newsbeitrag
    news:google.com... 
    news:<netlab.jp>... [/ref]
    would 
    >
    > Yes, I thought so, too. Their argument against mixins boiled down to
    > "What if you have identical methods in two different modules that you
    > wish to 'include'?". But, so far that just hasn't happened in my
    > personal experience.[/ref]

    The problem that I see is with using Modules is when traits have to be
    exchanged during the life time of an instance. At least I didn't manage
    to include a Module and de-include if afterwards. Or does simply
    "overriding" by including another module with similar methods solve the
    problem?

    Kind regards

    robert

    Robert Guest

  9. #9

    Default Re: OT: Traits

    "Robert Klemme" <net> wrote in message news:<c0q8nb$19imk0$news.uni-berlin.de>... 
    > news:<netlab.jp>... [/ref]
    > would 
    > >
    > > Yes, I thought so, too. Their argument against mixins boiled down to
    > > "What if you have identical methods in two different modules that you
    > > wish to 'include'?". But, so far that just hasn't happened in my
    > > personal experience.[/ref]
    >
    > The problem that I see is with using Modules is when traits have to be
    > exchanged during the life time of an instance. At least I didn't manage
    > to include a Module and de-include if afterwards.[/ref]

    It has been brought up a few times here in the past:
    Sometimes you want an object's role to change so it would be nice if
    there were some sort of uninclude <module> or unextend <module>
    methods.

    In the meantime, it probably wouldn't be too hard to 'roll your own'
    uninclude. Just get the list of instance methods from the module and
    undef_method <methname> in the class. Something like:

    class Module
    def uninclude(mod)
    mod.instance_methods.each {|meth|
    undef_method meth
    }
    end
    end

    ....I'm still figuring out how to do unextend (which is arguably more
    useful than uninclude).

    Phil
    Phil Guest

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139