develooper Front page | perl.perl6.language | Postings from March 2006

'temp $x;' with no assignment

From:
Yuval Kogman
Date:
March 27, 2006 07:27
Subject:
'temp $x;' with no assignment
Message ID:
20060327152648.GA17665@woobling.org
Hi,

	my $x = 5;
	{
		temp $x;
		# is $x 5 or undef?
	}
	# $x is definately 10

I think it should be 5 inside, because it makes it easy to write
things like:

	my $x = 5;
	{
		temp $x++;
		# $x is 6
	}
	# $x is 5 again

and otherwise pretty much DWIMs, except from a historical
perspective.

-- 
  Yuval Kogman <nothingmuch@woobling.org>
http://nothingmuch.woobling.org  0xEBD27418




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