Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Roles and functional programming

by Bloodnok (Vicar)
on Nov 26, 2008 at 15:50 UTC ( [id://726135]=note: print w/replies, xml ) Need Help??


in reply to Roles and functional programming

As a self-acclaimed unexpert in the field, is it just me, or does the paper, amogst other things, present a more formal recognition/definition of the notion of abstract/pure virtual classes ?

.oO(...sits back, once more, to await flames:-)

A user level that continues to overstate my experience :-))

Replies are listed 'Best First'.
Re^2: Roles and functional programming
by stvn (Monsignor) on Nov 26, 2008 at 21:21 UTC

    Except that roles/traits compose and abstract/virtual classes still just inherit. The composition is the real win with traits/roles, without it they would be nothing more then ... uhm... abstract/virtual classes ;)

    -stvn
      I think I must be missing the point stvn, I thought a class (in whatever language) was the composition of methods and/or data to model a behaviour.

      A user level that continues to overstate my experience :-))

        Yes, but there are different kinds of composition.

        With a class when you inherit from another class, it could be said you are "composing" the two classes together. In this type of composition (assuming everything is virtual methods), the subclass will "shadow" the superclass, but the superclass is still accessible to the subclass.

        With roles/traits the composition does not shadow but (via a set of rules) combine the two sets of methods/attributes into a new composite role/trait. In fact, after composition, the original roles can be discarded as all the nessecary info is now contained in the composite role. Also, because of the rules of composition, roles/traits are unordered, meaning you can compose the same set of roles/traits in arbitrary ways and still get the same composite trait in the end.

        -stvn

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://726135]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2024-04-19 22:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found