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

Re: RFC: Autoloading charnames

Thread Previous | Thread Next
Karl Williamson
November 27, 2011 14:30
Re: RFC: Autoloading charnames
Message ID:
On 11/26/2011 09:00 AM, Ricardo Signes wrote:
> * David Golden<>  [2011-11-22T18:51:35]
>> 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{}
> This summarized my feelings very well, too.
> I would prefer if \N{} did not cause charnames::viacode (etc) to just start
> working.  That is a pretty weak preference, but I prefer that functions like
> that have their module loaded explicitly.  \N{}, on the other hand, is (or
> ought to be) a much more basic language feature that should always work.
> This would require work to provide a way to only load charnames, and not
> everything else.  I know that work might not get done right now, and I think
> it's more useful to have \N{} Just Work than delay for this small point.
> My likely order of preference, best first:
>    1. using \N{} automatically loads the data needed to make it work, but
>       no other functions magically become available
>    2. using \N{} loads charnames normally, with documentation saying something
>       like "at present, using \N{} will load the charnames package, but this
>       is an implementation detail subject to change; if you're using functions
>       from it, C<use charnames>"
>    3. using \N{} loads charnames normally, and we 'fess up to it

I had prototyped #1  some time ago.  I used a simple solution to avoid 
importing the functions, and that was to use  undocumented mangled names 
for the function definitions in (simply prefixing them with 
an underscore, but further mangling could be done), and then in the 
import method, doing
*charnames::viacode = *_viacode;
*charnames::vianame = *_vianame;
*charnames::string_vianame = *_string_vianame;

Is this acceptable, or is a sub-module really needed?

This is already done, whereas making it XS is more work, which can be 
done later.

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