Skip to content

Conversation

@dur-randir
Copy link
Contributor

Seeing e559254, I couldn't pass. This greatly speeds it up and cuts code to half from the original.

XSRETURN( end - start );
while (--size >= 0) {
++SP;
*SP = *(SP + start);
Copy link
Contributor

@leonerd leonerd Nov 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm.. This is quite the change of behaviour - we're now returning aliases of the original input list, rather than new temporary SVs that copy it. This would have a change of behaviour in lvalue context; for example

my @n = (1 .. 10);
$_++ for tail 4, @n;

I'm undecided if that's a good thing or not.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If such code wouldn't work before, I'd say this would just be a new feature...

Copy link
Contributor

@leonerd leonerd Nov 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could be considered a feature yes. But it's a somewhat surprising change of behaviour. Is there a chance of accidental collateral damage?


I've asked for further opinion on p5p@ since it's a core module.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returning aliases is the behavior I would expect.

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

Successfully merging this pull request may close these issues.

4 participants