develooper Front page | perl.perl5.porters | Postings from April 2000

Re: [ID 20000403.009] uninitialised concatenation???

From:
Ronald J Kimball
Date:
April 4, 2000 09:04
Subject:
Re: [ID 20000403.009] uninitialised concatenation???
Message ID:
20000404120329.F299251@linguist.dartmouth.edu
On Tue, Apr 04, 2000 at 09:22:08AM -0600, Tom Christiansen wrote:
> my(%h, %g, $x, $y, $z);
> %h = ($x => $y . $z);
> %g = %h;
> Use of uninitialized value in concatenation (.) at - line 3.
> Use of uninitialized value in concatenation (.) at - line 3.
> Use of uninitialized value in list assignment at - line 3.
> 
> There was no list on either side.  Those are just hashes.
> It's an "accident of the compiler's implementation" that
> this turns into a list.  It could detect this and do something
> else.   

Running that code produces warnings for line 2, not line 3.


> my(@a, %h, $x, $y, $z);
> @a = ($x => $x, "$x", "$y$z", undef() => $x.$y.$z);
> %h = ($x => "@a", @a => @a, $y => join($x,$y,$z), @a);
> Use of uninitialized value in string at - line 2.
> Use of uninitialized value in concatenation (.) at - line 2.
> Use of uninitialized value in concatenation (.) at - line 2.
> Use of uninitialized value in concatenation (.) at - line 2.
> Use of uninitialized value in concatenation (.) at - line 2.
> Use of uninitialized value in concatenation (.) at - line 2.
> Use of uninitialized value in join at - line 3.
> Use of uninitialized value in join at - line 3.
> Use of uninitialized value in join at - line 3.
> Use of uninitialized value in join at - line 3.
> Use of uninitialized value in join at - line 3.
> Use of uninitialized value in join at - line 3.
> Use of uninitialized value in list assignment at - line 3.
> Use of uninitialized value in list assignment at - line 3.
> Use of uninitialized value in list assignment at - line 3.
> Use of uninitialized value in list assignment at - line 3.
> Use of uninitialized value in list assignment at - line 3.
> Use of uninitialized value in list assignment at - line 3.
> Use of uninitialized value in list assignment at - line 3.
> Use of uninitialized value in list assignment at - line 3.
> 
> I ask you seriously: what it the *OPTIMAL* text you want to see here?
> Let's pretend nothing is impossible.  What do you REALLY want?


If nothing were impossible, I think something like this would be optimal:

Value of lexical $x is undefined in string at - line 2.
Value of lexical $y is undefined in string at - line 2.
Value of lexical $z is undefined in string at - line 2.
Value of lexical $x is undefined in concatenation (.) at - line 2.
Value of lexical $y is undefined in concatenation (.) at - line 2.
Value of lexical $z is undefined in concatenation (.) at - line 2.
Value of element 0 of lexical @a is undefined in string at - line 3.
Value of element 1 of lexical @a is undefined in string at - line 3.
Value of element 4 of lexical @a is undefined in string at - line 3.
Value of lexical $x is undefined in join at - line 3.
Value of lexical $y is undefined in join at - line 3.
Value of lexical $z is undefined in join at - line 3.
Value of lexical $x is undefined in hash assignment at - line 3.
Value of element 0 of lexical @a is undefined in hash assignment at - line 3.
Value of element 4 of lexical @a is undefined in hash assignment at - line 3.
Value of element 0 of lexical @a is undefined in hash assignment at - line 3.
Value of element 4 of lexical @a is undefined in hash assignment at - line 3.
Value of lexical $y is undefined in hash assignment at - line 3.
Value of element 0 of lexical @a is undefined in hash assignment at - line 3.
Value of element 4 of lexical @a is undefined in hash assignment at - line 3.


In a case such as C<undef() . "">, I would do:

Value is undefined in concatenation ...

or something like that.


The perldiag entry would be:

Value%s is undefined in %s


Ronald



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