Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Quickcheck of context of index expressions
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
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
 
Autrijus Tang  
View profile  
 More options Apr 25 2005, 3:33 pm
Newsgroups: perl.perl6.language
From: autri...@autrijus.org (Autrijus Tang)
Date: Tue, 26 Apr 2005 03:33:44 +0800
Local: Mon, Apr 25 2005 3:33 pm
Subject: Quickcheck of context of index expressions

Another quick check on expression context for indexed expressions.
Please sanity-check the return value of want() below:

    @x[0] = want();   # scalar context
    @x[want()] = $_;  # scalar context
    @x[want()] = @_;  # scalar context
    @x[0,] = want();  # list context
    @x[want(),] = $_; # list context
    @x[want(),] = @_; # list context
    $_ = @x[want()];  # scalar context
    @_ = @x[want()];  # list context

Thanks,
/Autrijus/

  application_pgp-signature_part
< 1K Download

 
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.
Autrijus Tang  
View profile  
 More options Apr 25 2005, 3:56 pm
Newsgroups: perl.perl6.language
From: autri...@autrijus.org (Autrijus Tang)
Date: Tue, 26 Apr 2005 03:56:37 +0800
Local: Mon, Apr 25 2005 3:56 pm
Subject: Re: Quickcheck of context of index expressions

On Tue, Apr 26, 2005 at 03:33:44AM +0800, Autrijus Tang wrote:
> Another quick check on expression context for indexed expressions.
> Please sanity-check the return value of want() below:

>     @x[0] = want();        # scalar context
>     @x[want()] = $_;       # scalar context
>     @x[want()] = @_;       # scalar context
>     @x[0,] = want();       # list context
>     @x[want(),] = $_; # list context
>     @x[want(),] = @_; # list context
>     $_ = @x[want()];       # scalar context
>     @_ = @x[want()];       # list context

Oh, and under the S02 rules above (the index expression inherits
outer context on RHS), Pugs currently does this:

    $_ = %x{ 1, 2 }  
        --- reduces to ---
        $_ = %x{ [1, 2] }
            --- reduces to ---
            $_ = %x{ "1 2" }

Which is, well, very surprising.  Where did I get wrong?

Thanks,
/Autrijus/

  application_pgp-signature_part
< 1K Download

 
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.
Autrijus Tang  
View profile  
 More options Apr 29 2005, 9:37 am
Newsgroups: perl.perl6.language
From: autri...@autrijus.org (Autrijus Tang)
Date: Fri, 29 Apr 2005 21:37:30 +0800
Local: Fri, Apr 29 2005 9:37 am
Subject: Re: Quickcheck of context of index expressions

On Fri, Apr 29, 2005 at 06:22:57AM -0700, Larry Wall wrote:
> :     @x[want()] = $_;  # scalar context
> :     @x[want()] = @_;  # scalar context

> Maybe "unknown" context, which defaults to list.

I think allowing unknown LHS index expression to default to
scalar context is a bit more useful here.  Since we have:

    @x[0]  = @y;        # scalar
    @x[0,] = @y;        # list

This may be more intuitive:

    @x[idx()]  = @y;    # scalar
    @x[idx(),] = @y;    # list

Than this:

    @x[+idx()] = @y;    # scalar
    @x[idx()]  = @y;    # list

But I don't really feel strongly one way or another, as long
as it is specced down. :)

Thanks,
/Autrijus/

  application_pgp-signature_part
< 1K Download

 
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.
Larry Wall  
View profile  
 More options Apr 29 2005, 9:22 am
Newsgroups: perl.perl6.language
From: la...@wall.org (Larry Wall)
Date: Fri, 29 Apr 2005 06:22:57 -0700
Local: Fri, Apr 29 2005 9:22 am
Subject: Re: Quickcheck of context of index expressions
On Tue, Apr 26, 2005 at 03:33:44AM +0800, Autrijus Tang wrote:

: Another quick check on expression context for indexed expressions.
: Please sanity-check the return value of want() below:
:
:     @x[0] = want();   # scalar context

Good.

:     @x[want()] = $_;  # scalar context
:     @x[want()] = @_;  # scalar context

Maybe "unknown" context, which defaults to list.

:     @x[0,] = want();  # list context
:     @x[want(),] = $_; # list context
:     @x[want(),] = @_; # list context
:     $_ = @x[want()];  # scalar context
:     @_ = @x[want()];  # list context

No, I think they're all list context.

Larry


 
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.
Larry Wall  
View profile  
 More options Apr 29 2005, 9:27 am
Newsgroups: perl.perl6.language
From: la...@wall.org (Larry Wall)
Date: Fri, 29 Apr 2005 06:27:35 -0700
Local: Fri, Apr 29 2005 9:27 am
Subject: Re: Quickcheck of context of index expressions
On Tue, Apr 26, 2005 at 03:56:37AM +0800, Autrijus Tang wrote:

: On Tue, Apr 26, 2005 at 03:33:44AM +0800, Autrijus Tang wrote:
: > Another quick check on expression context for indexed expressions.
: > Please sanity-check the return value of want() below:
: >
: >     @x[0] = want();      # scalar context
: >     @x[want()] = $_;     # scalar context
: >     @x[want()] = @_;     # scalar context
: >     @x[0,] = want();     # list context
: >     @x[want(),] = $_; # list context
: >     @x[want(),] = @_; # list context
: >     $_ = @x[want()];     # scalar context
: >     @_ = @x[want()];     # list context
:
: Oh, and under the S02 rules above (the index expression inherits
: outer context on RHS), Pugs currently does this:
:
:     $_ = %x{ 1, 2 }  
:       --- reduces to ---
:       $_ = %x{ [1, 2] }
:           --- reduces to ---
:           $_ = %x{ "1 2" }
:
: Which is, well, very surprising.  Where did I get wrong?

I think S02 is probably wrong.  It should be unknown/list context.

Sorry for the short answers, but I'm in Russia behind a flakey network
connection, which is probably going away entirely at any moment (the
network connection, not Russia.) I can clarify more next week when
I get back.

Larry


 
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.
Autrijus Tang  
View profile  
 More options Apr 29 2005, 11:20 am
Newsgroups: perl.perl6.language
From: autri...@autrijus.org (Autrijus Tang)
Date: Fri, 29 Apr 2005 23:20:52 +0800
Local: Fri, Apr 29 2005 11:20 am
Subject: Re: Quickcheck of context of index expressions

On Fri, Apr 29, 2005 at 06:22:57AM -0700, Larry Wall wrote:
> :     @x[want()] = $_;  # scalar context
> :     @x[want()] = @_;  # scalar context

> Maybe "unknown" context, which defaults to list.

> :     @x[0,] = want();  # list context
> :     @x[want(),] = $_; # list context
> :     @x[want(),] = @_; # list context
> :     $_ = @x[want()];  # scalar context
> :     @_ = @x[want()];  # list context

> No, I think they're all list context.

Okay. r2478 has them reverted to the original form, which
inspects the declared return type of want() to see if it is a subtype
of Scalar; if it is, then it is taken as scalar context;
otherwise (or if multiple multisubs are possible), it defaults
to list context.

Thanks,
/Autrijus/

  application_pgp-signature_part
< 1K Download

 
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.
End of messages
« Back to Discussions « Newer topic     Older topic »