Navigation Menu

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

List in item context misbehaves #710

Closed
p6rt opened this issue Feb 19, 2009 · 9 comments
Closed

List in item context misbehaves #710

p6rt opened this issue Feb 19, 2009 · 9 comments

Comments

@p6rt
Copy link

p6rt commented Feb 19, 2009

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

Searchable as RT63350$

@p6rt
Copy link
Author

p6rt commented Feb 19, 2009

From @moritz

Rakudo 00e9db​:

.say for (1, 2, 3).item

prints three lines, although it should be just one (same as for [1, 2,
3]), see http://irclog.perlgeek.de/perl6/2009-02-19#i_924753 and below.

There's a test for that in t/spec/S02-builtin_data_types/array.t now.

Cheers,
Moritz

--
Moritz Lenz
http://perlgeek.de/ | http://perl-6.de/ | http://sudokugarden.de/

@p6rt
Copy link
Author

p6rt commented Feb 19, 2009

From @pmichaud

On Thu Feb 19 12​:03​:03 2009, mlenz@​physik.uni-wuerzburg.de wrote​:

Rakudo 00e9db​:

.say for (1, 2, 3).item

prints three lines, although it should be just one (same as for [1, 2,
3]), see http://irclog.perlgeek.de/perl6/2009-02-19#i_924753 and below.

There's a test for that in t/spec/S02-builtin_data_types/array.t now.

...not so fast, there's more! :-)

20​:02 <pmichaud> with .say for (1,2,3).item
20​:03 <pmichaud> why would that not be 1\n2\n3\n ?
20​:03 <moritz_> because it's one item over which for iterate
20​:03 <TimToady> (1,2,3).item should be equiv to [1,2,3]
20​:03 <moritz_> *iterates
20​:03 <pmichaud> yes, but how does that differ from .say for @​a ?
20​:04 <TimToady> @​a interpolates, [] doesn't; I guess I think of it as
[] since it's anonymous
20​:04 <pmichaud> I know that @​a interpolations and [] doesn't, but what
distinguishes the two internally?
20​:04 <pmichaud> *interpolates
20​:05 <TimToady> I suppose [] is really Scalar of Array
20​:05 <pmichaud> right
20​:05 <pmichaud> that's what Rakudo currently does
20​:05 <pmichaud> so does this mean that .item also implies Scalar of ... ?
20​:06 <pmichaud> i.e., so that (1,2,3).item would return a reference as
opposed to just an Array ?
20​:06 <TimToady> lemme think about that

@p6rt
Copy link
Author

p6rt commented Feb 19, 2009

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

@p6rt
Copy link
Author

p6rt commented Feb 19, 2009

From @pmichaud

On Thu Feb 19 12​:03​:03 2009, mlenz@​physik.uni-wuerzburg.de wrote​:

Rakudo 00e9db​:

.say for (1, 2, 3).item

prints three lines, although it should be just one (same as for [1, 2,
3]), see http://irclog.perlgeek.de/perl6/2009-02-19#i_924753 and below.

There's a test for that in t/spec/S02-builtin_data_types/array.t now.

...not so fast, there's more! :-)

20​:02 <pmichaud> with .say for (1,2,3).item
20​:03 <pmichaud> why would that not be 1\n2\n3\n ?
20​:03 <moritz_> because it's one item over which for iterate
20​:03 <TimToady> (1,2,3).item should be equiv to [1,2,3]
20​:03 <moritz_> *iterates
20​:03 <pmichaud> yes, but how does that differ from .say for @​a ?
20​:04 <TimToady> @​a interpolates, [] doesn't; I guess I think of it as
[] since it's anonymous
20​:04 <pmichaud> I know that @​a interpolations and [] doesn't, but what
distinguishes the two internally?
20​:04 <pmichaud> *interpolates
20​:05 <TimToady> I suppose [] is really Scalar of Array
20​:05 <pmichaud> right
20​:05 <pmichaud> that's what Rakudo currently does
20​:05 <pmichaud> so does this mean that .item also implies Scalar of ... ?
20​:06 <pmichaud> i.e., so that (1,2,3).item would return a reference as
opposed to just an Array ?
20​:06 <TimToady> lemme think about that

@p6rt
Copy link
Author

p6rt commented Mar 10, 2009

From @pmichaud

On Thu Feb 19 12​:03​:03 2009, mlenz@​physik.uni-wuerzburg.de wrote​:

Rakudo 00e9db​:

.say for (1, 2, 3).item

prints three lines, although it should be just one (same as for [1, 2,
3]), see http://irclog.perlgeek.de/perl6/2009-02-19#i_924753 and below.

There's a test for that in t/spec/S02-builtin_data_types/array.t now.

I think that the specification has changed such that Rakudo does the
right thing -- in particular, (1,2,3).item is no longer the same as [1,2,3].

I've updated the test to match (r25791) and closing ticket.

Pm

@p6rt
Copy link
Author

p6rt commented Mar 10, 2009

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

@p6rt p6rt closed this as completed Mar 10, 2009
@p6rt
Copy link
Author

p6rt commented Jun 13, 2010

From @pmichaud

Update 2010-06-13​: As part of the list/iterator refactor taking place
in Rakudo and the specification, I've since decided that this test
should result in one iteration, not three, and have updated the
spectests to match. (The new version of Rakudo in the 'list' branch
already behaves this way.)

Pm

@p6rt
Copy link
Author

p6rt commented Oct 9, 2010

From @kyleha

This is an automatically generated mail to inform you that tests are now available in S02-builtin_data_types/array.t

commit d8e4ca96b03fdea174d34dc3f4102de23c7ed177
Author​: Moritz Lenz <moritz@​faui2k3.org>
Date​: Sat Oct 9 22​:39​:40 2010 +0200

  [array.t] unfudge test for RT #​63350, also add a similar one for $()
 
  Also covers RT #​78284, which seems to be mostly a duplicate of 63350

Inline Patch
diff --git a/S02-builtin_data_types/array.t b/S02-builtin_data_types/array.t
index 8283e98..8d3f026 100644
--- a/S02-builtin_data_types/array.t
+++ b/S02-builtin_data_types/array.t
@@ -2,7 +2,7 @@ use v6;
 
 use Test;
 
-plan 103;
+plan 104;
 
 #L<S02/Mutable types/Array>
 
@@ -13,12 +13,16 @@ plan 103;
 }
 
 
-#?rakudo todo "RT #63350"
 {
-    # see also RT #63350 for discussion
+    # see RT #63350 for discussion
+    # also: 78284
     my $i = 0;
     $i++ for (1, 2, 3).item;
     is $i, 1, 'for (1, 2, 3).item does one iteration';
+
+    $i = 0;
+    $i++ for $(1, 2, 3);
+    is $i, 1, 'for $(1, 2, 3) does one iteration';
 }
 
 {

@p6rt
Copy link
Author

p6rt commented Oct 9, 2010

From @moritz

Fixed in 5ce8fcfe541b6eb2426ea64247bf01998b0d5208, test unfudged.
The fix also introduced a regression, which is now tracked in RT #​78284

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

No branches or pull requests

1 participant