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

qqw{} and qqww{} flattening behaviour doesn't match #3681

Closed
p6rt opened this issue Feb 12, 2015 · 6 comments
Closed

qqw{} and qqww{} flattening behaviour doesn't match #3681

p6rt opened this issue Feb 12, 2015 · 6 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Feb 12, 2015

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

Searchable as RT123808$

@p6rt
Copy link
Author

p6rt commented Feb 12, 2015

From paul@liekut.de

It seems that although qqw{} and << >> are equivalent

my $a = 42;
<<$a b c>>.perl; # ("42", "b", "c")
qqw{$a b c}.perl; # ("42", "b", "c")

they don't always behave the same. For instance​:

my $a = 42; say <<$a b c>>; # 42bc
my $a = 42; say qqw{$a b c}; # 42 b c

moritz++ used this on IRC​:
sub f(*@​a) { say @​a.elems }; my $a = 42; f «$a b c»; f qqw{$a b c}
OUTPUT«3␤3␤»

multi f(*@​a) { say @​a.elems }; multi f($one) { say 'one'}; f «b c»; f qqw{b c}
OUTPUT«2␤one␤»

and showed that the quoting constructs differ when there is a single-element multi candidate available.

One would expect that these two constructs should behave in the same manner.

@p6rt
Copy link
Author

p6rt commented Mar 1, 2015

From @Mouq

Actually, it's qqww{} and << >> that are supposed to be equivalent. And they are when it comes to capture context​:

$ perl6 -e'my $a = 42; say <<$a b c>>;'
42bc
$ perl6 -e'my $a = 42; say qqww{$a b c};'
42bc
$ perl6 -e'my $a = 42; say qqw{$a b c};'
42 b c

It's less misleading to say that qqww{} and qqw{} don't flatten the same.

On Thu Feb 12 04​:25​:15 2015, pcoch wrote​:

It seems that although qqw{} and << >> are equivalent

my $a = 42;
<<$a b c>>.perl; # ("42", "b", "c")
qqw{$a b c}.perl; # ("42", "b", "c")

they don't always behave the same. For instance​:

my $a = 42; say <<$a b c>>; # 42bc
my $a = 42; say qqw{$a b c}; # 42 b c

moritz++ used this on IRC​:
sub f(*@​a) { say @​a.elems }; my $a = 42; f «$a b c»; f qqw{$a b c}
OUTPUT«3␤3␤»

multi f(*@​a) { say @​a.elems }; multi f($one) { say 'one'}; f «b c»; f
qqw{b c}
OUTPUT«2␤one␤»

and showed that the quoting constructs differ when there is a single-
element multi candidate available.

One would expect that these two constructs should behave in the same
manner.

@p6rt
Copy link
Author

p6rt commented Mar 1, 2015

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

@p6rt
Copy link
Author

p6rt commented Nov 17, 2015

From @coke

On Sun Mar 01 15​:24​:23 2015, Mouq wrote​:

Actually, it's qqww{} and << >> that are supposed to be equivalent.
And they are when it comes to capture context​:

$ perl6 -e'my $a = 42; say <<$a b c>>;'
42bc
$ perl6 -e'my $a = 42; say qqww{$a b c};'
42bc
$ perl6 -e'my $a = 42; say qqw{$a b c};'
42 b c

It's less misleading to say that qqww{} and qqw{} don't flatten the
same.

On Thu Feb 12 04​:25​:15 2015, pcoch wrote​:

It seems that although qqw{} and << >> are equivalent

my $a = 42;
<<$a b c>>.perl; # ("42", "b", "c")
qqw{$a b c}.perl; # ("42", "b", "c")

they don't always behave the same. For instance​:

my $a = 42; say <<$a b c>>; # 42bc
my $a = 42; say qqw{$a b c}; # 42 b c

moritz++ used this on IRC​:
sub f(*@​a) { say @​a.elems }; my $a = 42; f «$a b c»; f qqw{$a b c}
OUTPUT«3␤3␤»

multi f(*@​a) { say @​a.elems }; multi f($one) { say 'one'}; f «b c»; f
qqw{b c}
OUTPUT«2␤one␤»

and showed that the quoting constructs differ when there is a single-
element multi candidate available.

One would expect that these two constructs should behave in the same
manner.

Current situation​:

15​:20 < jnthn> m​: my $a = 42; say <<$a b c>>;
15​:20 <+camelia> rakudo-moar 7c6a55​: OUTPUT«(42 b c)␤»
15​:21 < jnthn> m​: my $a = 42; say qqww{$a b c};
15​:21 <+camelia> rakudo-moar 7c6a55​: OUTPUT«(42 b c)␤»
15​:21 < jnthn> m​: my $a = 42; say qqw{$a b c};
15​:21 <+camelia> rakudo-moar 7c6a55​: OUTPUT«[42 b c]␤»

15​:21 < jnthn> m​: my $a = 42; say .WHAT for <<$a b c>>, qqww{$a b c}, qqw{$a b
  c}
15​:21 <+camelia> rakudo-moar 7c6a55​: OUTPUT«(List)␤(List)␤(Array)␤»
15​:22 < jnthn> [Coke]​: Bit dubious that the last one is Array, not List too
15​:22 < [Coke]> I'll add that to the ticket. Thanks.

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Dec 12, 2015

From @jnthn

On Tue Nov 17 12​:23​:28 2015, coke wrote​:

Current situation​:

15​:20 < jnthn> m​: my $a = 42; say <<$a b c>>;
15​:20 <+camelia> rakudo-moar 7c6a55​: OUTPUT«(42 b c)␤»
15​:21 < jnthn> m​: my $a = 42; say qqww{$a b c};
15​:21 <+camelia> rakudo-moar 7c6a55​: OUTPUT«(42 b c)␤»
15​:21 < jnthn> m​: my $a = 42; say qqw{$a b c};
15​:21 <+camelia> rakudo-moar 7c6a55​: OUTPUT«[42 b c]␤»

15​:21 < jnthn> m​: my $a = 42; say .WHAT for <<$a b c>>, qqww{$a b c},
qqw{$a b
c}
15​:21 <+camelia> rakudo-moar 7c6a55​: OUTPUT«(List)␤(List)␤(Array)␤»
15​:22 < jnthn> [Coke]​: Bit dubious that the last one is Array, not
List too
15​:22 < [Coke]> I'll add that to the ticket. Thanks.

Corrected that one that accidentally returned Array; tests in S02-literals/quoting.t.

@p6rt
Copy link
Author

p6rt commented Dec 12, 2015

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

@p6rt p6rt closed this as completed Dec 12, 2015
@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant