Skip to content

Commit

Permalink
Remove spurious laziness checks. Please.
Browse files Browse the repository at this point in the history
It is neither specced nor tested for that an unshift to a lazy
construct should be illegal.  There are commented out tests
in roast, but they are obviously just copies from when someone
cut and pasted push-related code to make the unshift test file,
and it is quite likely that the actual tests in current code is
likewise just leftover from not noticing that this test is not
needed for unshift.

(It is specced that *infinite* things fail when they are the
things being unshifted onto the target, but this is not
implementable unless we have some sort of depth limiter pragma.)
  • Loading branch information
skids committed Aug 14, 2015
1 parent b2609e9 commit 4ef8859
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/core/Array.pm
Expand Up @@ -234,7 +234,6 @@ my class Array { # declared in BOOTSTRAP
multi method unshift(Array:D: \value) {
if nqp::iscont(value) || nqp::not_i(nqp::istype(value, Iterable)) {
self!ensure-allocated();
fail X::Cannot::Lazy.new(action => 'unshift to') if self.is-lazy;

nqp::unshift(
nqp::getattr(self, List, '$!reified'),
Expand All @@ -251,7 +250,6 @@ my class Array { # declared in BOOTSTRAP
}
method !unshift-list(@values) {
self!ensure-allocated();
fail X::Cannot::Lazy.new(action => 'unshift to') if self.is-lazy;

# unshift is always eager
@values.elems;
Expand Down

0 comments on commit 4ef8859

Please sign in to comment.