Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^3: Open to debate on mixins and traits.

by bsb (Priest)
on Jun 03, 2004 at 13:59 UTC ( [id://360148]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Open to debate on mixins and traits.
in thread Open to debate on mixins and traits.

I think you and I are on different trips here. I don't know what the real story is though.

I don't see why Perl needs interfaces in any form, they're just there to satisfy the compiler in statically typed languages, aren't they?

I think of roles as reuseable partial classes. So they add generic behaviour, customized by the state accessors they use (or metadata). I'm more going from the paper than A12, though.

  • Comment on Re^3: Open to debate on mixins and traits.

Replies are listed 'Best First'.
Re^4: Open to debate on mixins and traits.
by chromatic (Archbishop) on Jun 03, 2004 at 18:34 UTC
    I don't see why Perl needs interfaces in any form, they're just there to satisfy the compiler in statically typed languages, aren't they?

    Barring my opinion that Java interfaces are so far broken they're almost worse than not even attempting to solve the problem, no.

    Type systems aren't only for statically typed languages. They're useful in dynamic systems as well as systems which can't do every type check at compile time. (These two categories overlap a bit.)

    The nice thing about having language support for interfaces in your type system is being able to check that an object you've received somehow conforms to the interface you expect to use with it. It's a little nicer if the language can check that for you (whether statically, at compile time, dynamically, or at runtime), but at worse, you can also check it yourself.

Re^4: Open to debate on mixins and traits.
by adrianh (Chancellor) on Jun 03, 2004 at 14:37 UTC
    I don't see why Perl needs interfaces in any form, they're just there to satisfy the compiler in statically typed languages, aren't they?

    No they're not ;-) Not if we're using the term as used in Java land anyway. They're a way of talking about common behaviour that cuts across class hierarchy boundaries.

    In Perl 6 they're subsumed by roles (a Java interface would the equivalent to a role without any implementation code.)

    (Note: Apply my standard "I've not read A12 properly yet" disclaimer to the previous sentence, but I'm sure chromatic will correct me if I'm wrong :-)

Re^4: Open to debate on mixins and traits.
by BrowserUk (Patriarch) on Jun 03, 2004 at 16:59 UTC
    I don't see why Perl needs interfaces in any form, they're just there to satisfy the compiler in statically typed languages, aren't they?

    Sorry! My fault. It doesn't. It won't. It can't. Never, never, never. Forget I used the words!


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "Think for yourself!" - Abigail

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2024-04-24 20:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found