develooper Front page | perl.perl5.porters | Postings from November 2011

Re: RFC: Autoloading charnames

Thread Previous | Thread Next
Jesse Luehrs
November 22, 2011 16:02
Re: RFC: Autoloading charnames
Message ID:
On Tue, Nov 22, 2011 at 06:51:35PM -0500, David Golden wrote:
> On Tue, Nov 22, 2011 at 5:23 PM, Jesse Luehrs <> wrote:
> >> I don't like general-purpose auto-loading.  However, I can see the
> >> case for \N{} (just I saw the case for autoloading IO::File when
> >> methods are called on filehandles.  If \N{} does load charnames, then
> >> I would expect charnames::viacode(...) to work.  However, without
> >> prior \N{} (assuming compile-time loading), I would expect
> >> charnames::viacode() to be a compilation error.
> >
> > I personally wouldn't expect the presence or absence of a \N{} escape at
> > some arbitrary location in my code (possibly even in a different file)
> > to make the difference (on its own) of whether calling functions in
> > charnames:: worked or not. This seems like it would cause confusion.
> Let me clarify:  *if* we say that \N{} autoloads charnames, then I
> would expect things everywhere to behave just as if there were "use
> charnames qw/:full :short/" as the statement before the statement with
> \N{}.
> It all comes down to how we document it.  If we say that all the
> Unicode character names are available for use with \N{}, without
> specifying how that is implemented, then I could also support having
> some private charnames::guts module be loaded behind the scenes to
> provide the mapping.  That would leave not loaded so that
> charnames::viacode() continues to be an error.   Then using \N{} just
> has a one-time cost but DWIMs and you don't need
> to know about charnames at all.
> Put differently, we should *NOT* do either of these:
> (a) *say* we autoload charnames on \N{} and then *not* have
> charnames::viacode() be a valid function call after \N{}
> (b) *don't say* anything about charnames, but have
> charnames::viacode() be valid after \N{}

I can agree with these two statements. I think that not documenting the
implementation details makes the most sense - just say that all names
are available with \N{}, and don't mention charnames in connection with
that at all (other than as a "see also" or something).


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About