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

Re: RFC: Autoloading charnames

Thread Previous | Thread Next
Tom Christiansen
November 23, 2011 08:07
Re: RFC: Autoloading charnames
Message ID:
Karl Williamson <> wrote
   on Wed, 23 Nov 2011 07:51:59 MST: 

>>>> I don't see why using a \N{} sequence should have any impact on what
>>>> functions are available to use in my code.

>>> Compare:
>>>   $ perl -wE 'binmode STDOUT; warn File::Spec->catfile("foo","bar")'
>>>   Can't locate object method "catfile" via package "File::Spec" (perh<SNIP>
>>> with:
>>>   $ perl -wE 'STDOUT->binmode; warn File::Spec->catfile("foo","bar")'
>>>   foo/bar at -e line 1.

>> Sure, I think that's confusing too.

> FWIW, I find this confusing as well, yet this is how things work today:

> 	$ blead -E '
> 	    print charnames::viacode(0x41), "\n";
> 	    package foo {
>      	    	use charnames();
>           }'

> Loading charnames in a different scope, even package, enables
> use of the functions at a distance.


> Does this fact change anyone's opinion?

It may, but it doesn't change *mine*.  This is just how things happen 
in Perl, and there's no way to address it without redesigning the whole
language from the ground up; see Perl6.

And er, I've actually made intentional use of the sort of thing you show in
the quoted portion.  Similarly with IO:: stuff.  It's probably a dumb thing
to do, but I knew that was how Perl happens to work, so I did it.  It's a
bit embarrassing but there it is.  You use what's there.

Perl really isn't spec-based to allow one to adjudge a bug from a feature
based on a formal spec, so there's a lot of this sort of thing going around.


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