Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"print 'a'.WHAT;" leaks internal variable #2802

Closed
p6rt opened this issue Jun 28, 2012 · 9 comments
Closed

"print 'a'.WHAT;" leaks internal variable #2802

p6rt opened this issue Jun 28, 2012 · 9 comments

Comments

@p6rt
Copy link

p6rt commented Jun 28, 2012

Migrated from rt.perl.org#113888 (status was 'resolved')

Searchable as RT113888$

@p6rt
Copy link
Author

p6rt commented Jun 28, 2012

From @Siddhant

$ perl6 --version
This is perl6 version 2012.06-41-g88a9d69 built on parrot 4.5.0
revision RELEASE_4_5_0

In Rakudo's REPL​:

print 'a'.WHAT;
use of uninitialized variable $v of type Str in string context
True

The part about "$v" is a bug. It should just be
  "use of uninitialized value of type Str in string context"

@p6rt
Copy link
Author

p6rt commented May 14, 2014

From @coke

On Thu Jun 28 09​:52​:22 2012, sisar wrote​:

$ perl6 --version
This is perl6 version 2012.06-41-g88a9d69 built on parrot 4.5.0
revision RELEASE_4_5_0

In Rakudo's REPL​:

print 'a'.WHAT;
use of uninitialized variable $v of type Str in string context
True

The part about "$v" is a bug. It should just be
"use of uninitialized value of type Str in string context"

This now behaves​:

$ ./perl6-m

print 'a'.WHAT;
use of uninitialized value of type Str in string context
True

Closable with tests.

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented May 14, 2014

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Jan 20, 2015

From @usev6

On Wed May 14 10​:24​:26 2014, coke wrote​:

On Thu Jun 28 09​:52​:22 2012, sisar wrote​:

$ perl6 --version
This is perl6 version 2012.06-41-g88a9d69 built on parrot 4.5.0
revision RELEASE_4_5_0

In Rakudo's REPL​:

print 'a'.WHAT;
use of uninitialized variable $v of type Str in string context
True

The part about "$v" is a bug. It should just be
"use of uninitialized value of type Str in string context"

This now behaves​:

$ ./perl6-m

print 'a'.WHAT;
use of uninitialized value of type Str in string context
True

Closable with tests.

This has changed slightly​:

$ ./perl6-m

print 'a'.WHAT
use of uninitialized value <element> of type Str in string context in block <unit> at <unknown file>​:1

True

So, now there is an additional '<element>' in the warning.

Apart from that I found the warning message not too awesome. If I understand correctly, print() can only print objects of type Str, while say() calls .gist on all non-Str objects (http://design.perl6.org/S32/IO.html#print%28%29). Maybe it would make sense to add the first point to the warning message?

1 similar comment
@p6rt
Copy link
Author

p6rt commented Jan 20, 2015

From @usev6

On Wed May 14 10​:24​:26 2014, coke wrote​:

On Thu Jun 28 09​:52​:22 2012, sisar wrote​:

$ perl6 --version
This is perl6 version 2012.06-41-g88a9d69 built on parrot 4.5.0
revision RELEASE_4_5_0

In Rakudo's REPL​:

print 'a'.WHAT;
use of uninitialized variable $v of type Str in string context
True

The part about "$v" is a bug. It should just be
"use of uninitialized value of type Str in string context"

This now behaves​:

$ ./perl6-m

print 'a'.WHAT;
use of uninitialized value of type Str in string context
True

Closable with tests.

This has changed slightly​:

$ ./perl6-m

print 'a'.WHAT
use of uninitialized value <element> of type Str in string context in block <unit> at <unknown file>​:1

True

So, now there is an additional '<element>' in the warning.

Apart from that I found the warning message not too awesome. If I understand correctly, print() can only print objects of type Str, while say() calls .gist on all non-Str objects (http://design.perl6.org/S32/IO.html#print%28%29). Maybe it would make sense to add the first point to the warning message?

@p6rt
Copy link
Author

p6rt commented Sep 16, 2015

From @skids

On Tue Jan 20 13​:39​:43 2015, bartolin@​gmx.de wrote​:

On Wed May 14 10​:24​:26 2014, coke wrote​:

On Thu Jun 28 09​:52​:22 2012, sisar wrote​:

$ perl6 --version
This is perl6 version 2012.06-41-g88a9d69 built on parrot 4.5.0
revision RELEASE_4_5_0

In Rakudo's REPL​:

print 'a'.WHAT;
use of uninitialized variable $v of type Str in string context
True
[...]
This has changed slightly​:

$ ./perl6-m

print 'a'.WHAT
use of uninitialized value <element> of type Str in string context in
block <unit> at <unknown file>​:1

True

So, now there is an additional '<element>' in the warning.

Apart from that I found the warning message not too awesome. If I
understand correctly, print() can only print objects of type Str,
while say() calls .gist on all non-Str objects
(http://design.perl6.org/S32/IO.html#print%28%29). Maybe it would make
sense to add the first point to the warning message?

This is now​:

$ perl6

print 'a'.WHAT
Use of uninitialized value of type Str in string context
Any of .^name, .perl, .gist, or .say can stringify undefined things, if needed. in block <unit> at <unknown file>​:1
True

Tests have been added for the typename, and the help message, but it
is hard to add tests for random leaky things being added later on
because we don't know what they might look like.

@p6rt
Copy link
Author

p6rt commented Sep 16, 2015

From @usev6

On Wed Sep 16 07​:56​:33 2015, bri@​abrij.org wrote​:

On Tue Jan 20 13​:39​:43 2015, bartolin@​gmx.de wrote​:

On Wed May 14 10​:24​:26 2014, coke wrote​:

On Thu Jun 28 09​:52​:22 2012, sisar wrote​:

$ perl6 --version
This is perl6 version 2012.06-41-g88a9d69 built on parrot 4.5.0
revision RELEASE_4_5_0

In Rakudo's REPL​:

print 'a'.WHAT;
use of uninitialized variable $v of type Str in string context
True
[...]
This has changed slightly​:

$ ./perl6-m

print 'a'.WHAT
use of uninitialized value <element> of type Str in string context
in
block <unit> at <unknown file>​:1

True

So, now there is an additional '<element>' in the warning.

Apart from that I found the warning message not too awesome. If I
understand correctly, print() can only print objects of type Str,
while say() calls .gist on all non-Str objects
(http://design.perl6.org/S32/IO.html#print%28%29). Maybe it would
make
sense to add the first point to the warning message?

This is now​:

$ perl6

print 'a'.WHAT
Use of uninitialized value of type Str in string context
Any of .^name, .perl, .gist, or .say can stringify undefined things,
if needed. in block <unit> at <unknown file>​:1
True

Tests have been added for the typename, and the help message, but it
is hard to add tests for random leaky things being added later on
because we don't know what they might look like.

This looks good to me, thanks! I'm closing this ticket as 'resolved'.

1 similar comment
@p6rt
Copy link
Author

p6rt commented Sep 16, 2015

From @usev6

On Wed Sep 16 07​:56​:33 2015, bri@​abrij.org wrote​:

On Tue Jan 20 13​:39​:43 2015, bartolin@​gmx.de wrote​:

On Wed May 14 10​:24​:26 2014, coke wrote​:

On Thu Jun 28 09​:52​:22 2012, sisar wrote​:

$ perl6 --version
This is perl6 version 2012.06-41-g88a9d69 built on parrot 4.5.0
revision RELEASE_4_5_0

In Rakudo's REPL​:

print 'a'.WHAT;
use of uninitialized variable $v of type Str in string context
True
[...]
This has changed slightly​:

$ ./perl6-m

print 'a'.WHAT
use of uninitialized value <element> of type Str in string context
in
block <unit> at <unknown file>​:1

True

So, now there is an additional '<element>' in the warning.

Apart from that I found the warning message not too awesome. If I
understand correctly, print() can only print objects of type Str,
while say() calls .gist on all non-Str objects
(http://design.perl6.org/S32/IO.html#print%28%29). Maybe it would
make
sense to add the first point to the warning message?

This is now​:

$ perl6

print 'a'.WHAT
Use of uninitialized value of type Str in string context
Any of .^name, .perl, .gist, or .say can stringify undefined things,
if needed. in block <unit> at <unknown file>​:1
True

Tests have been added for the typename, and the help message, but it
is hard to add tests for random leaky things being added later on
because we don't know what they might look like.

This looks good to me, thanks! I'm closing this ticket as 'resolved'.

@p6rt
Copy link
Author

p6rt commented Sep 16, 2015

@usev6 - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant