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

Re: RFC: Autoloading charnames

Thread Previous | Thread Next
Jesse Luehrs
November 22, 2011 14:23
Re: RFC: Autoloading charnames
Message ID:
On Tue, Nov 22, 2011 at 05:17:41PM -0500, David Golden wrote:
> On Tue, Nov 22, 2011 at 5:03 PM, Karl Williamson
> <> wrote:
> > It has been proposed that charnames automatically load when a \N{} is seen.
> >  That is easy to do, and I think it should load as if the :full and :short
> > options had both been specified.
> >
> > Does anyone disagree with doing this?
> What are the pros and cons, specifically, of choosing either or both
> of :full and :short?  Would it be loaded at compile time or runtime?
> > If it is done, should the functions in the module also autoload.  That is,
> > should a line like 'my $poo = charnames::viacode(0x1F4A9)' fail if charnames
> > hasn't been 'used' or 'required' or should it cause the module to load ?
> 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.


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