PugsBugs: Weird behavior of shift
flag
2 messages - Collapse all
/groups/adfetch?adid=icA1RhIAAACEXyjXcV17QCjwSIyOMYKGxyxpo7bMRVgpn9ZMKisPfQ
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
1.  Stevan Little  
View profile  
 More options Apr 18 2005, 12:08 am
Newsgroups: perl.perl6.compiler
From: ste...@iinteractive.com (Stevan Little)
Date: Mon, 18 Apr 2005 00:08:36 -0400
Local: Mon, Apr 18 2005 12:08 am
Subject: PugsBugs: Weird behavior of shift
These examples:

        pugs -e 'say shift [1, 2, 3].shift'
        pugs -e 'say shift([1, 2, 3].shift)'
        pugs -e 'say shift([1, 2, 3]).shift'

do not ever return, but yet does not seem to chew up the CPU either.

Meanwhile, these examples:

        pugs -e 'say pop [1, 2, 3].pop'
        pugs -e 'say pop([1, 2, 3].pop)'
        pugs -e 'say pop([1, 2, 3]).pop'

all print '3'.

Just a weird one, I thought I would share it. I am not even sure it is
really a bug to be honest (other than the fact it does not seem to
return).

Stevan


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
2.  Larry Wall  
View profile  
 More options Apr 18 2005, 10:18 am
Newsgroups: perl.perl6.compiler
From: la...@wall.org (Larry Wall)
Date: Mon, 18 Apr 2005 07:18:29 -0700
Local: Mon, Apr 18 2005 10:18 am
Subject: Re: PugsBugs: Weird behavior of shift
On Mon, Apr 18, 2005 at 12:08:36AM -0400, Stevan Little wrote:

: These examples:
:
:       pugs -e 'say shift [1, 2, 3].shift'
:       pugs -e 'say shift([1, 2, 3].shift)'
:       pugs -e 'say shift([1, 2, 3]).shift'
:
: do not ever return, but yet does not seem to chew up the CPU either.

I don't see how those can be semantically valid, even if they parse.
I read them as shifting the return value of a shift, which would
be an attempt to shift on a scalar.

: Meanwhile, these examples:
:
:       pugs -e 'say pop [1, 2, 3].pop'
:       pugs -e 'say pop([1, 2, 3].pop)'
:       pugs -e 'say pop([1, 2, 3]).pop'
:
: all print '3'.

Same problem.  3.pop doesn't mean much.  All I can figure is that
it's following the list-in-scalar context rule to make [3].pop
out of it.

Larry


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google