develooper Front page | perl.fwp | Postings from July 2003

Re: my if?

From:
Bernie Cosell
Date:
July 1, 2003 11:37
Subject:
Re: my if?
Message ID:
200307011837.h61IbHbO013919@mail.rev.net
On 1 Jul 2003 at 17:01, Ton Hospel wrote:

> In article <200307011440.h61EeYbh017204@mail.rev.net>,
> 	"Bernie Cosell" <bernie@fantasyfarm.com> writes:

> > It is undefined behavior [even though it works currently in every version 
> > of Perl] and so it IS best to avoid it.  What I don't understand is why 
> > the powers-that-be provide so much resistance to putting in a simple 
> > 'static' declaration that would work the same way, only be defined-and-
> > legal.  e.g.,:
> >    sub x
> >    {   static $vbl ;
> >         [...]
> > 
> > Oh well, I guess re-opening that wound isn't much fun...
> 
> It doesn't really give you anything you don't already have by writing
> 
> {
>     my $vbl;
>     sub x {
>     ....
>     }
> }

"Give you anything" isn't really the point -- Perl is filled with 
multiple ways to do things and the simple argument that you can do 
something similar using some other mechanism is rarely determinative.

Virtually EVERY programmer knows what a simple static variable is -- and 
while I do recognize [and use] a closure to get the effect of a static 
variable, it is hardly as clear and simple as being able to do:
   sub x
   {
     static $vbl;
       ...
and I doubt that anyone other than a fairly experienced Perl programmer 
would quickly apprehend that construct as even _being_ a simple static.

But, again, this debate isn't 'fun'.  sigh..

  /Bernie\

-- 
Bernie Cosell                     Fantasy Farm Fibers
mailto:bernie@fantasyfarm.com     Pearisburg, VA
    -->  Too many people, too few sheep  <--       






nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About