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

LTA error message for attempting to use a signature in a list assignment #1726

Open
p6rt opened this issue Apr 25, 2010 · 7 comments
Open

LTA error message for attempting to use a signature in a list assignment #1726

p6rt opened this issue Apr 25, 2010 · 7 comments
Labels
Bug LTA Less Than Awesome; typically an error message that could be better

Comments

@p6rt
Copy link

p6rt commented Apr 25, 2010

Migrated from rt.perl.org#74664 (status was 'open')

Searchable as RT74664$

@p6rt
Copy link
Author

p6rt commented Apr 25, 2010

From @sorear

15​:14 < sorear> rakudo​: my ($foo, $bar = "baz") = <a>; say "$foo $bar"
15​:14 <+p6eval> rakudo e393c7​: OUTPUT«Undefined value shifted from empty
  array␤current instr.​: 'perl6;Perl6Exception;throw' pc 14877
  (src/builtins/Seq.pir​:28)␤»
15​:20 <@​jnthn> I think we probably should just complain at parse time actually.
15​:20 <@​jnthn> We parse a signature there, but if you're starting to stick in
  optional parameters and stuff, we just say "oh noes, that's too
  complex to turn into a list".
15​:20 <@​jnthn> If you want full signature semantics, use binding, not
  assignment.
15​:21 <@​jnthn> Us not complaining about the signature being too complex is a
  rakudo fail.
15​:21 <@​jnthn> It's a bit annoying implementation wise.
15​:21 <@​jnthn> Because you parse a signature always but in the = case you want
  to do list assignment.
15​:22 <@​jnthn> So you need to turn the signature into a list.
15​:22 <@​jnthn> Which doesn't make sense if it's anything complex.

@p6rt
Copy link
Author

p6rt commented Jul 24, 2010

From @moritz

19​:36 <@​moritz_> rakudo​: my ($foo, $bar = "baz") = <a>; say "$foo $bar"
19​:36 <+p6eval> rakudo 928f9d​: OUTPUT«a Any()␤»

Much better now, though not perfect.

@p6rt
Copy link
Author

p6rt commented Jul 24, 2010

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

@p6rt
Copy link
Author

p6rt commented Feb 1, 2012

From @coke

On Sat Jul 24 10​:38​:58 2010, moritz wrote​:

19​:36 <@​moritz_> rakudo​: my ($foo, $bar = "baz") = <a>; say "$foo $bar"
19​:36 <+p6eval> rakudo 928f9d​: OUTPUT«a Any()␤»

Much better now, though not perfect.

Slight change​:

09​:20 < [Coke]> rakudo​: my ($foo, $bar = "baz") = <a>; say "$foo $bar" #RT
  #​74664
09​:20 <+p6eval> rakudo ce5cca​: OUTPUT«a ␤»

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Oct 3, 2016

From @MasterDuke17

On Wed Feb 01 06​:21​:05 2012, coke wrote​:

On Sat Jul 24 10​:38​:58 2010, moritz wrote​:

19​:36 <@​moritz_> rakudo​: my ($foo, $bar = "baz") = <a>; say "$foo $bar"
19​:36 <+p6eval> rakudo 928f9d​: OUTPUT«a Any()␤»

Much better now, though not perfect.

Slight change​:

09​:20 < [Coke]> rakudo​: my ($foo, $bar = "baz") = <a>; say "$foo $bar" #RT
#​74664
09​:20 <+p6eval> rakudo ce5cca​: OUTPUT«a ␤»

perl6 -e 'my ($foo, $bar = "baz") = <a>; say "$foo $bar"'
Use of uninitialized value $bar of type Any in string context.
Methods .^name, .perl, .gist, or .say can be used to stringify it to something meaningful.
  in block <unit> at -e line 1
a

perl6 --version
This is Rakudo version 2016.09 built on MoarVM version 2016.09
implementing Perl 6.c.

@p6rt p6rt added the Bug label Jan 5, 2020
@MasterDuke17 MasterDuke17 added the LTA Less Than Awesome; typically an error message that could be better label Feb 8, 2020
@JJ
Copy link

JJ commented May 30, 2020

If I get this right, this should complain about the fact that it's a list. Saying that it's uninitialized anyway makes no sense... Also, same problem in 2020.05

@JJ
Copy link

JJ commented Dec 29, 2020

Updated:

my ($foo, $bar = "baz") = <a>;
say ~$foo;
say ~$bar; # Use of uninitialized value $bar of type Any in string context.

Not totally sure this is incorrect now. Since the pair is assigned a list with a single element, the non-existing second element clobbers what's in there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug LTA Less Than Awesome; typically an error message that could be better
Projects
None yet
Development

No branches or pull requests

3 participants