Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^4: Perl allows package names consisting entirely of colons

by tobyink (Abbot)
on Nov 27, 2012 at 16:30 UTC ( #1005879=note: print w/ replies, xml ) Need Help??


in reply to Re^3: Perl allows package names consisting entirely of colons
in thread Perl allows package names consisting entirely of colons

"why disallow it?"

I never meant to imply that it should be disallowed. I was just expressing surprise that it is not disallowed, given that Perl does place limits on what tokens may appear in a package declaration.

Why disallow package 123 and package 123:: but allow package ::123? The tokens allowed to follow package are have interesting but seemingly arbitrary restrictions, which have nothing to do with what names are actually usable for naming functions, variables, etc...

use 5.010; use strict qw( vars subs ); use warnings; # Package name contains whitespace; sub name begins with leading colon +. *{"123 :::x"} = sub { say "hello" }; # Yet it can be called. &{"123 :::x"};
perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'


Comment on Re^4: Perl allows package names consisting entirely of colons
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1005879]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (12)
As of 2014-07-22 14:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (114 votes), past polls