in reply to All uppercase subs

Subroutines whose names are in all upper case are reserved to the Perl core, as are modules whose names are in all lower case.

I must say that this seems to me an unreasonable claim on "valid-identifier space" on the part of Perl's core. I wonder why the core doesn't settle for reserving identifiers of the form __THIS_OR_THAT__, for example.

the lowliest monk

Replies are listed 'Best First'.
Re^2: All uppercase subs
by ysth (Canon) on Jul 17, 2005 at 12:47 UTC
    Because people don't like ugly names like that? Do read that section of the doc and see what kind of uses it is talking about. Some more recent names that have acquired special meaning: CHECK, UNTIE, CLONE, SCALAR, CLONE_SKIP.

      Well, there's already ample precedent for "ugly names like that", such as __DATA__ and __PACKAGE__. Programmers need all the help they can get at the time of devising useful typographic conventions for identifiers, since the good alternatives are so few. One of these few good alternatives is the all-cap identifier, and I think it is a shame that the core has declared it off-limits.

      Update: Besides, the core can still reserve specific all-cap identifiers such as the one you list, just like it reserves any other specific keyword (if, else, for, etc.). My objection is to the blanket claim on all all-cap identifiers.

      the lowliest monk

        I think that the specially named subs deserve having beautiful names. OTOH I don't consider __DATA__ and __PACKAGE__ to be "ugly names" at all. They're nice as special tokens, and I must say I regret they (being supposed) not to be there in Perl6.

        As Larry himself wrote once, the shebang line

        #!/usr/bin/perl
        is much like a "hello!" and the
        __END__
        line is much like a "goodbye". Now IIRC it is supposed to be taken away in favour of a pod (or whatever it will eventaully be called) directive. But I mean: maybe it's just me, but I'm really keen on that "__END__".
Re^2: All uppercase subs
by blazar (Canon) on Jul 18, 2005 at 14:00 UTC
    In some sense you're right. But then should we have __BEGIN__ blocks? Or do you mean only with restriction to possible future reserved sub names?