in reply to Re^4: Detecting an imported function
in thread Detecting an imported function

When I wrote Perl6::Roles, stvn and I talked through this issue, along with chromatic, Luke, and Tim. The P6 spec says a few things:

More importantly, it currently says nothing on whether a role exposes an interface or if it is, itself, the interface. Please bring that up on P6l if that's a problem for you. Right now, P6 roles export EVERTHING, including methods, subs, and the like.

I briefly thought about providing an optional mechanism by which you can specify in the role what it actually exports. I didn't implement it because that wasn't one of Tim's requirements and I was writing this for him to use in DBIv2. However, if that is one of your requirements, I can easily add it in less than 20 minutes. Please specify if you want to use an array a la Exporter or if you want to use attributes.


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?

Replies are listed 'Best First'.
Re^6: Detecting an imported function
by Ovid (Cardinal) on Nov 17, 2005 at 17:30 UTC

    So, on my wishlist:

    1. Only export methods this the trait promises to provide
    2. Conflict resolution via method renaming
    3. Conflict resolution via denying a method (so another trait can provide it)
    4. Trait requirements must be explicitly met or we fail at compile time
    5. Properly respecting the above traits even when aggregating traits into a new trait

    With the exception of the first item on that list, Class::Trait handles this. Does Perl6::Roles handle these? If so, I'll consider a switch.

    Cheers,
    Ovid

    New address of my CGI Course.

      Perl6::Roles handles #5 correctly. The rest weren't requirements of Tim, so I didn't implement them. Please provide an API for each item and I'll gladly implement them. Of course, it'd be best if the API was as close as possible to what P6 roles will do, but I'll consider any suggestion.

      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?

        I happen to have an API spec handy. Fancy that ;)

        Frankly, without the rest, we don't have traits as described by the traits paper. Thus, traits are reduced to little more than glorified exporting packages (which, to be honest, I was using until Class::Trait fixed some of the more serious issues).

        As for writing a real API spec, I'd love to, but that would take a bit of time and I do have real work to do :( (and I might get this problem solved with Class::Trait in the time it would take me to write up the spec).

        I hope this doesn't sound like I'm dismissing your offer. I really appreciate it, but rewriting the traits papers or some Perl 6 notes would take quite a bit of time to do correctly. On the other hand, if you came up with a working model, I'd happily look at it.

        Cheers,
        Ovid

        New address of my CGI Course.