in reply to Re: Using perl 6 roles in perl 5
in thread Using perl 6 roles in perl 5

I should have looked - that was dumb. But looking at the code, they seem to be using a similar approach.

Which is good.

It just seems annoying to have to require a module whose purpose, in my code, I am accomplishing in a few lines.

It's the old roll-your-own scenario. I'll insist on using my own code because I'm-only-using-it-in-this-one-place and probably 6 months down the line, I'll rip it out and replace it with one concise nicely written and document module installed from CPAN.

But how else do we ever learn?

Now where is my home-rolled templating system? No, not those ones, the other one.

Replies are listed 'Best First'.
Re^3: Using perl 6 roles in perl 5
by dragonchild (Archbishop) on Jan 18, 2006 at 15:26 UTC
    But how else do we ever learn?

    By improving on the current systems, not by rewriting them. Take a look at the code for Perl6::Roles. For the most part, it's just syntactic sugar. Class::Trait is more involved, but it's still just sugar, at its heart.

    If there's a feature you want or a performance benchmark you feel you need to hit, write a failing test and give it to the author. That way, everyone benefits from what you're trying to do.


    My criteria for good software:
    1. Does it work?
    2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
      You're right.

      I now need to write another class which inherits the caching but not the database interface functionality from my base classes, and suddenly roles seem like a really really good idea.

      And using a contained module seems like a much better idea than the few lines of code which did the job just 2 hours ago.

      By improving on the current systems, not by rewriting them.
      Out of interest, why did you rewrite Perl6::Role when Class::Role already existed?
        It was in response to tbunce's request for a different roles implementation so that DBIv2 could move forward. The feature needed was run-time composition which creates a new class.

        For the record, I wrote Perl6::Roles with the help/support of the authors of the other three roles implementations on CPAN at the time.


        My criteria for good software:
        1. Does it work?
        2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?