Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • I bet you could manage to do this via a class like Class::Classless, and have /all/ specialized objects belong to your special class, and have it not be ISA anything. Then your dispatcher (in can/AUTOLOAD) would look for a method in the object, then in the classes that the object is specially tagged as belonging to. Make sense?
    • Having taken a closer look at Class::Classless (nice work there btw), I'm sure that that approach could be made to work, but:
      1. AFAICT it'll only work for blessed hashes, and I'm not even sure it'd work that well with them.
      2. Even assuming you're happy with nothing but blessed hashes, I'm not entirely sure it'd be possible to write a UNIVERSAL::specialize that would allow you to lazily specialize any object you like.
      3. An anonymous symbol table approach would almost certainly be substantially faster.

      Of course, Class::Classless has the enormous advantage of actually existing.

      Which is definitely a big advantage.

      I like anonymous symbol tables as an idea though. I'm sure there's lots more that could be done with them than just specialized objects. Blessed symbol tables anyone?