Re: Apocalypse 4 : The Strange Case of the STRANGE CASE

2002-01-25 Thread Me

I would not be appalled if Perl 6 were to assume use
of caps for catcher block labels, but I would still like to
see Larry et al reconsider this design choice.

One suggestion is use of label syntax for catcher
blocks (suggests come-from). If catch and CATCH
were defined as synonyms, then one could type:

LAST: {

or

last: {

--me




Re: Apocalypse 4 : The Strange Case of the STRANGE CASE

2002-01-24 Thread Andy Wardley

On Wed, Jan 23, 2002 at 08:30:41AM -0800, Larry Wall wrote:
 : 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.
 
 Yes, they are unusual.  They're more like come froms than gotos.
 They need to stop people cold from trying to read them as inline code.
 People are naturally uncomfortable when they get shouted at, and that's
 as it should be.  

A little bit of shouting is OK, but it's easy to switch off when you 
get shouted at all the time.  These constructs are likely to be used 
right throughout a typical Perl program and I don't want to be made
to feel uncomfortable *all* the time when I'm trying to concentrate on
what the program does.

 It is distasteful that a policeman should have to turn on his lights
 and siren when he wants to get your attention, but the practice is a
 useful bit of society nonetheless.

But if he kept doing it all day, every day, it would be police harrassment.

:-)


A




Re: Apocalypse 4 : The Strange Case of the STRANGE CASE

2002-01-24 Thread Peter Haworth

On Wed, 23 Jan 2002 08:30:41 -0800 (PST), Larry Wall wrote:
 Andy Wardley writes:
 : Same with 'last/NEXT' - they're so similar
 : in concept that the implementation details should not matter.
 
 You mean last/LAST and next/NEXT, I suspect.  But there's another
 argument for case differentiation.  By this argument, the rethink should
 go in the opposite direction, giving us catch/CATCH.

I like that, especially because it makes the try with no CATCH read better:

  try { ... } # But what happens if we fail?

  catch { ... } # Implicit CATCH, now made explicit!

-- 
Peter Haworth   [EMAIL PROTECTED]
Jerry Springer- champion of the American free man or penile freak master?
-- something Ashley Pomeroy read in _the Guardian_



Re: Apocalypse 4 : The Strange Case of the STRANGE CASE

2002-01-24 Thread Larry Wall

Peter Haworth writes:
: On Wed, 23 Jan 2002 08:30:41 -0800 (PST), Larry Wall wrote:
:  Andy Wardley writes:
:  : Same with 'last/NEXT' - they're so similar
:  : in concept that the implementation details should not matter.
:  
:  You mean last/LAST and next/NEXT, I suspect.  But there's another
:  argument for case differentiation.  By this argument, the rethink should
:  go in the opposite direction, giving us catch/CATCH.
: 
: I like that, especially because it makes the try with no CATCH read better:
: 
:   try { ... } # But what happens if we fail?
: 
:   catch { ... } # Implicit CATCH, now made explicit!

It may read better, but it doesn't pronounce better, since they'd both
be called catch blocks.  I can just see all the instructors whispering
catch block and shouting CATCH block...

It would, however, really foul up the plans of anyone wanting to define
their own lower-case catch block to be more like the try/catch they're
used to in other languages...  ;-)

Larry



Re: Apocalypse 4 : The Strange Case of the STRANGE CASE

2002-01-23 Thread Tim Bunce

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 +, 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
 



Re: Apocalypse 4 : The Strange Case of the STRANGE CASE

2002-01-23 Thread Jonathan Scott Duff

On Wed, Jan 23, 2002 at 11:50:54AM +, Tim Bunce wrote:
 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[*].

Not early enough to catch import() though.  Oh well ... Perl 6 will
fix that.  (For various definitions of fix  ;-)

 I'm not uncomfortable with the apparent try/CATCH inconsistency.

Same here. People are just used to try/catch from other languages that
are philisophically bent different.  That just makes try/CATCH
inconsistent with those languages, not with Perl.

-Scott
-- 
Jonathan Scott Duff
[EMAIL PROTECTED]



Re: Apocalypse 4 : The Strange Case of the STRANGE CASE

2002-01-23 Thread Casey West

On Wed, Jan 23, 2002 at 01:45:44PM -0600, Jonathan Scott Duff wrote:
:
:On Wed, Jan 23, 2002 at 11:50:54AM +, Tim Bunce wrote:
: 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[*].
:
:Not early enough to catch import() though.  Oh well ... Perl 6 will
:fix that.  (For various definitions of fix  ;-)

import() is not called automatically by Perl.  It's called
automatically by the module Exporter.pm.  Subtle but important
difference there.

  Casey West

-- 
Shooting yourself in the foot with Mach
The bullets work pretty well, but they don't make guns for it any
more.



Re: Apocalypse 4 : The Strange Case of the STRANGE CASE

2002-01-23 Thread Casey West

On Wed, Jan 23, 2002 at 03:21:37PM -0500, Casey West wrote:
:
:On Wed, Jan 23, 2002 at 01:45:44PM -0600, Jonathan Scott Duff wrote:
::
::On Wed, Jan 23, 2002 at 11:50:54AM +, Tim Bunce wrote:
:: 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[*].
::
::Not early enough to catch import() though.  Oh well ... Perl 6 will
::fix that.  (For various definitions of fix  ;-)
:
:import() is not called automatically by Perl.  It's called
:automatically by the module Exporter.pm.  Subtle but important
:difference there.

My bad, that's wrong.  I think what my brain wanted to say is that it
is lowercase because Exporter.pm came before use() or something like
that.  Where was my morning coffee hiding today?

  Casey West

-- 
Shooting yourself in the foot with Cray
You shoot yourself in the foot with an Uzi.