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

FIRST and LAST behave inconsistently (and annoyingly) #3404

Closed
p6rt opened this issue Jun 2, 2014 · 5 comments
Closed

FIRST and LAST behave inconsistently (and annoyingly) #3404

p6rt opened this issue Jun 2, 2014 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Jun 2, 2014

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

Searchable as RT122011$

@p6rt
Copy link
Author

p6rt commented Jun 2, 2014

From damian@conway.org

The following test program demonstrates that, under Rakudo perl6 version
2014.04 built on MoarVM version 2014.04, a FIRST block is only called if
a loop block is actually executed, but a LAST block is called even the
block is skipped. This seems inconsistent and certainly makes FIRST/LAST
less useful. The behaviour of FIRST seems correct; the behaviour of LAST
seems wrong.

Specifically, I expected to get​:

  {1, 2, 3, }

but I got​:

  {1, 2, 3, }
  }

which seems to suggest LAST isn't quite right yet.

Damian

-----cut----------cut----------cut----------cut----------cut----------cut----------cut-----

use v6;

my @​list;

@​list = 1..3;
for (@​list) -> $n {
  FIRST { print '{' }
  print "$n, ";
  LAST { say '}' }
}

@​list = ();
for (@​list) -> $n {
  FIRST { print '{' }
  print "$n, ";
  LAST { say '}' }
}

-----end----------end----------end----------end----------end----------end----------end-----

@p6rt
Copy link
Author

p6rt commented Jun 2, 2014

From @masak

Commit 1bb76a6 in roast adds a test (in S04-phasers/in-loop.t) for the expectation expressed in this ticket​: that LAST not fire if the loop doesn't have iterations.

@p6rt
Copy link
Author

p6rt commented Jun 2, 2014

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

@p6rt
Copy link
Author

p6rt commented Jun 2, 2014

From @jnthn

On Mon Jun 02 14​:06​:49 2014, masak wrote​:

Commit 1bb76a6 in roast adds a test (in S04-phasers/in-loop.t) for the
expectation expressed in this ticket​: that LAST not fire if the loop
doesn't have iterations.

Fixed in bec414d in Rakudo; resolving.

@p6rt p6rt closed this as completed Jun 2, 2014
@p6rt
Copy link
Author

p6rt commented Jun 2, 2014

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

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