I see your point, but I find it interesting that one of Perl's standard modules, AutoLoader, is there precisely to support the loading of subs upon first use.

Which prompts the question: why does Perl actively support such a problematic feature? Two possible explanations come to mind: (a) lazy loading of subs was a bad idea from the start (for the reasons you describe), and future versions of Perl should get rid of it; or (b) there are a few rare instances in which the benefits of lazy loading outweigh its drawbacks, hence Perl supports it.

If I know anything about Perl culture, then I'd guess that (b) is by far the more likely explanation of the two, and I'm left to imagining what those "few rare instances" may be like. The only situation I can envision in which lazy loading may be desirable (despite its drawbacks) is one in which the possible methods are vastly more numerous than those that are actually used by any application. But this is all theoretical, since I don't recall ever using a module that fit this description.

Update: Just to be clear: I'm not presenting the existence of AutoLoader or its presence in the core as a veiled argument in favor of anything. I am genuinely interested in the question of why it's in the core in the first place: was it a mistake, or is it there because there are some legitimate (even if rare) uses for it?

the lowliest monk


In reply to Re^10: Modules for autogenerating accessor/mutator methods by tlm
in thread Modules for autogenerating accessor/mutator methods by srdst13

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.