develooper Front page | perl.perl6.language | Postings from February 2001

Re: JWZ on s/Java/Perl/

Thread Previous | Thread Next
From:
Bart Lateur
Date:
February 11, 2001 02:34
Subject:
Re: JWZ on s/Java/Perl/
Message ID:
a7qc8tsar0st41rg74hutn3epv9o061ufo@4ax.com
On Fri, 9 Feb 2001 16:14:34 -0800, Mark Koopman wrote:

>but is this an example of the way people SHOULD code, or simply are ABLE to 
>code this.   are we considering to deprecate this type of bad style, and force
>to a programmer to, in this case, supply a ref to %baz in the arguements to
>this sub?

I think you're trying too hard turning Perl into just another C clone.
Dynamic variable allocation and freeing, like this, are one of the main
selling points for Perl as a language.

Note that %baz can, as values, also contain references to other
lexically scoped varibles, like \$foo and \$bar. No prototping around
that.

>> 	sub test {
>> 	    my($foo, $bar, %baz);
>> 	    ...
>> 	    return \%baz;
>> 	}

You could, theoretically, create special versions of "my", or a "my"
with an attribute, so that these declared variables are kept out of the
normal lexical pool, and garbage collected in a more elaborate way,
perhaps even reference counting.

-- 
	Bart.

Thread Previous | Thread Next


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