On Sat, Jan 05, 2002 at 01:14:39AM +0000, Richard Clamp wrote:
> On Fri, Jan 04, 2002 at 04:53:20PM -0800, Paul Makepeace wrote:
> > $ perl -wle 'use strict; sub id {my $id if 0; $id++} print id,id,id'
> > 012
> > $
> > 
> > This idiom doesn't appear in perlsub. Anyone know about it?
> 
> Yes.
> 
> I assimilated it through reading p5p, but don't really use it.  
> 
> It's intentional I think, but possibly in a very after the fact "hey
> this implementation feature exists, but lets not toss it because it's
> useful" way.

Actually, it's more of an accident of implementation I think, related to
the compile time and run time nature of the construct.  It's not
documented because it might go away.  But then again, maybe it will get
blessed.

Either way, the topic comes up occasionally on p5p, but so far I don't
think any concensus has been reached.

I wouldn't use the construct if I were you.  There are better ways of
doing it.

It is quite easy to do by mistake though.  IIRC it was noticed that some
fairly high profile modules used the construct when the behaviour
changed at some point.  And I've certainly written it, if only until I
re-arrange the code.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

Reply via email to