Early on in the life of Perl 5 Larry adopted the convention that
subroutines that Perl calls automatically for you should have
all-caps names[*].

I'm not uncomfortable with the apparent try/CATCH inconsistency.
I suspect that having CATCH etc. be lowercase would create a greater
inconsistency in the 'big picture'. (Plus you'd get into problems
with NEXT vs next etc.)

Tim.

[*] Historical note: This actually came about partly because the
DBI ties a hash ref into the same class that the hash is blessed into.
Perl's tie FETCH method used to be called fetch, but that clashed
with the DBI's own fetch method.

On Tue, Jan 22, 2002 at 05:40:47PM +0000, Andy Wardley wrote:
> I was reading Apocalypse 4 and was perturbed by the strange and inconsistent
> looking use of UPPER and lower case in various keywords.
> 
> Now before anyone rushes to assist me in understanding the logic, I should
> say that we've already thrashed this out on the London.pm mailing list and
> several people (Hi Piers :-) have re-iterated the reasoning being the use
> of upper vs lower case.
> 
> In a nutshell, UPPER CASE is reserved for special Perl blocks that should
> stand out to the user due to the fact that they represent exception flow
> control.
> 
> It's a good, logical and consistent argument for sure, but sorry, I don't 
> buy it.  We end up with peculiarities like 'try/CATCH'.  Even if 'try'
> is a keyword and 'CATCH' is a special block, I can't see any valid reason
> for having them different case.  Same with 'last/NEXT' - they're so similar
> in concept that the implementation details should not matter.
> 
> By this argument, I could claim that the correct capitalisation of "knife
> and FORK" is based on the rule "cutting things are in lower case, spiking
> things are in UPPER CASE".  It's consistent and logical, but common sense
> should tell you that it's plain wrong.
> 
> INIT, DESTROY, AUTOLOAD, etc., all make sense to me.  They really are
> special blocks that normally only occur once in a file.  But CATCH and 
> NEXT are part of normal syntax.  I don't think they're any more "unusual"
> in their flow control than try, while, loop or foreach.
> 
> I think this needs a rethink.  What do other people think?
> 
> A
> 

Reply via email to