I just realized that I have been misunderstanding your proposal.

You think that whoever implements an AUTOLOAD should implement a can method in their own class that will indicate whether or not AUTOLOAD in that class will provide a given method, and then allows you to go to the NEXT class if it does not. (The amount of time that Perl went without a proper NEXT implementation is an example of why I don't assume that people will get multiple inheritance right.)

I thought that you thought that UNIVERSAL::can should be overrided like broquaint suggested so that an AUTOLOAD should be assumed to provide every method. Which is a simply horrible idea.

I still don't like your approach, but I dislike it less. My reason for disliking it is that you are making it darned easy for duplication of logic to happen, all to improve an (at this point pretty badly) broken assumption that can should see methods provided by AUTOLOAD. Trusting lots of different people to get something right is likely to break. Particularly if it isn't something currently being widely done. As evidenced by docs and current CPAN code. Heck, even core modules like AutoLoader don't think about can.

And what I don't trust will be done reliably, I prefer not to trust at all no matter how convenient it might be if it actually worked.

(Of course my tendancy is to write code to install many similar subroutines dynamically rather than lazily do it with AUTOLOAD. Which sidesteps the issue in another way)


In reply to Re: Re: Re: Re: Re: Re: Re: Symbol table globbing from object refs by tilly
in thread Symbol table globbing from object refs by nothingmuch

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.