Web Images Videos Maps News Shopping Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
array interpolation question
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
  12 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
 
Patrick R. Michaud  
View profile  
 More options Mar 5 2005, 11:39 am
Newsgroups: perl.perl6.compiler
From: pmich...@pobox.com (Patrick R. Michaud)
Date: Sat, 5 Mar 2005 10:39:45 -0600
Local: Sat, Mar 5 2005 11:39 am
Subject: Re: [pugs] array interpolation question

On Sat, Mar 05, 2005 at 11:22:23AM -0500, Garrett Rooney wrote:
> It looks like the current pugs array interpolation doesn't quite match
> the description in S02.
> [...]

This a (hopefully friendly) note regarding cross posting between
perl6-compiler (p6c) and perl6-language (p6l).  We're still feeling our
way around regarding "what belongs on p6c vs. p6l", but it seems
pretty clear to me that if the question is one of "perl6/pugs doesn't
properly implement feature X as given by the spec" then the post
belongs strictly on p6c.  We only bring p6l into the discussion if
the spec is ambiguous and it's something that can't be easily
decided/discussed within p6c itself.  This is just to keep
cross-postings and traffic to a minimum.

Patches to pugs or the perl6 compiler certainly belong *only* on p6c.

This message isn't intended as a rebuke at all -- all of the patches,
questions, and suggestions are very welcome!  It's just a
clarification since we're still just gettings underway on p6c.

Pm


    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.
Garrett Rooney  
View profile  
 More options Mar 5 2005, 11:25 am
Newsgroups: perl.perl6.compiler
From: roo...@electricjellyfish.net (Garrett Rooney)
Date: Sat, 05 Mar 2005 11:25:09 -0500
Local: Sat, Mar 5 2005 11:25 am
Subject: Re: [pugs] array interpolation question

Garrett Rooney wrote:
> Assuming the spec is correct, here's a patch to add some more tests to
> t/op/string_interpolation.t.

Of course, those should have been todo_is tests...  Here's the right patch.

-garrett

[ array-interp.diff < 1K ]
Index: t/op/string_interpolation.t
===================================================================
--- t/op/string_interpolation.t (revision 574)
+++ t/op/string_interpolation.t (working copy)
@@ -11,7 +11,7 @@

 =cut

-plan 5;
+plan 7;

 my $world = "World";

@@ -23,4 +23,7 @@

 sub list_count (*@args) { +@args }
 my @a = (1,2,3);
-ok(list_count("@a") == 1, 'quoted interpolation gets string context');
+ok(list_count("@a[]") == 1, 'quoted interpolation gets string context');
+
+todo_is("@a", '@a', "array without empty square brackets doesn't interpolate");
+todo_is("@a[]", '1 2 3', 'array with empty square brackets interpolates');


    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.
Garrett Rooney  
View profile  
 More options Mar 5 2005, 11:42 am
Newsgroups: perl.perl6.compiler
From: roo...@electricjellyfish.net (Garrett Rooney)
Date: Sat, 05 Mar 2005 11:42:17 -0500
Local: Sat, Mar 5 2005 11:42 am
Subject: Re: [pugs] array interpolation question

Patrick R. Michaud wrote:
> On Sat, Mar 05, 2005 at 11:22:23AM -0500, Garrett Rooney wrote:

>>It looks like the current pugs array interpolation doesn't quite match
>>the description in S02.
>>[...]
>>So what's right, the spec or the implementation?

> I should've also mentioned in my previous post that in this case,
> the spec is correct.  In general, for purposes of the compiler(s)
> we always assume that the spec is correct unless it's ambiguous
> or it leads to an absurd/contradictory conclusion, in which case
> we get the p6l folks to clarify/correct the spec.

That's what I though, but Autrijus suggested I check with p6l first.

-garrett


    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.
Patrick R. Michaud  
View profile  
 More options Mar 5 2005, 11:41 am
Newsgroups: perl.perl6.compiler
From: pmich...@pobox.com (Patrick R. Michaud)
Date: Sat, 5 Mar 2005 10:41:56 -0600
Local: Sat, Mar 5 2005 11:41 am
Subject: Re: [pugs] array interpolation question

On Sat, Mar 05, 2005 at 11:22:23AM -0500, Garrett Rooney wrote:
> It looks like the current pugs array interpolation doesn't quite match
> the description in S02.
> [...]
> So what's right, the spec or the implementation?

I should've also mentioned in my previous post that in this case,
the spec is correct.  In general, for purposes of the compiler(s)
we always assume that the spec is correct unless it's ambiguous
or it leads to an absurd/contradictory conclusion, in which case
we get the p6l folks to clarify/correct the spec.

Pm


    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.
Garrett Rooney  
View profile  
 More options Mar 5 2005, 11:22 am
Newsgroups: perl.perl6.compiler
From: roo...@electricjellyfish.net (Garrett Rooney)
Date: Sat, 05 Mar 2005 11:22:23 -0500
Local: Sat, Mar 5 2005 11:22 am
Subject: [pugs] array interpolation question

It looks like the current pugs array interpolation doesn't quite match
the description in S02.

S02 says that container references automatically dereference to the
appropriate (white space separated) string values, which is fine, pugs
does that now, but it also says that to interpolate an entire array you
need to subscript with empty brackets, so if we've got an array @a = (1,
2, 3) then "@a" eq '@a', but "@a[]" eq "1 2 3", at least from my reading
of the synopsis.

So what's right, the spec or the implementation?

Assuming the spec is correct, here's a patch to add some more tests to
t/op/string_interpolation.t.

-garrett

[ array-interp.diff < 1K ]
Index: t/op/string_interpolation.t
===================================================================
--- t/op/string_interpolation.t (revision 574)
+++ t/op/string_interpolation.t (working copy)
@@ -11,7 +11,7 @@

 =cut

-plan 5;
+plan 7;

 my $world = "World";

@@ -23,4 +23,7 @@

 sub list_count (*@args) { +@args }
 my @a = (1,2,3);
-ok(list_count("@a") == 1, 'quoted interpolation gets string context');
+ok(list_count("@a[]") == 1, 'quoted interpolation gets string context');
+
+is("@a", '@a', "array without empty square brackets doesn't interpolate");
+is("@a[]", '1 2 3', 'array with empty square brackets interpolates');


    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.
Patrick R. Michaud  
View profile  
 More options Mar 5 2005, 11:58 am
Newsgroups: perl.perl6.compiler
From: pmich...@pobox.com (Patrick R. Michaud)
Date: Sat, 5 Mar 2005 10:58:53 -0600
Local: Sat, Mar 5 2005 11:58 am
Subject: Re: [pugs] array interpolation question

Okay, no problem.  We're still learning and establishing where
the fuzzy boundaries are.  :-)

Perhaps a useful default will be to always start out by posting
messages and questions only to perl6-compiler.  Then if the answers
aren't available through p6c, we can then rephrase the questions
in terms of language design and forward them to p6l.

Pm


    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.
Luke Palmer  
View profile  
 More options Mar 5 2005, 4:39 pm
Newsgroups: perl.perl6.compiler
From: l...@luqui.org (Luke Palmer)
Date: Sat, 5 Mar 2005 14:39:06 -0700
Local: Sat, Mar 5 2005 4:39 pm
Subject: Re: [pugs] array interpolation question

Garrett Rooney writes:
> Garrett Rooney wrote:

> >Assuming the spec is correct, here's a patch to add some more tests to
> >t/op/string_interpolation.t.

> Of course, those should have been todo_is tests...  Here's the right patch.

Thanks, applied.

Luke


    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.
Autrijus Tang  
View profile  
 More options Mar 5 2005, 4:18 pm
Newsgroups: perl.perl6.compiler
From: autri...@autrijus.org (Autrijus Tang)
Date: Sun, 6 Mar 2005 05:18:50 +0800
Local: Sat, Mar 5 2005 4:18 pm
Subject: Re: [pugs] array interpolation question

On Sat, Mar 05, 2005 at 10:58:53AM -0600, Patrick R. Michaud wrote:
> On Sat, Mar 05, 2005 at 11:42:17AM -0500, Garrett Rooney wrote:
> > That's what I though, but Autrijus suggested I check with p6l first.

> Okay, no problem.  We're still learning and establishing where
> the fuzzy boundaries are.  :-)

Yup.  Now reading S02 again, it is pretty clear that p6l would
not be needed -- Sorry for my out of context suggestion on IRC.

> Perhaps a useful default will be to always start out by posting
> messages and questions only to perl6-compiler.  Then if the answers
> aren't available through p6c, we can then rephrase the questions
> in terms of language design and forward them to p6l.

That indeed sounds like a good rule-of-thumb. :)

Thanks,
/Autrijus/

  application_pgp-signature_part
< 1K Download

    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.
Discussion subject changed to "svn.openfoundry.org back" by Autrijus Tang
Autrijus Tang  
View profile  
 More options Mar 6 2005, 11:00 am
Newsgroups: perl.perl6.compiler
From: autri...@autrijus.org (Autrijus Tang)
Date: Mon, 7 Mar 2005 00:00:02 +0800
Local: Sun, Mar 6 2005 11:00 am
Subject: svn.openfoundry.org back

On Sat, Mar 05, 2005 at 02:39:06PM -0700, Luke Palmer wrote:
> Thanks, applied.
> Luke

Thanks a lot for applying the patches to svn.perl.org. :-)

This is jsut a heads-up to say that svn.openfoundry.org is back,
so committers, please commit to openfoundry.org as usual.

Cheers,
/Autrijus/

  application_pgp-signature_part
< 1K Download

    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.
Discussion subject changed to "array interpolation implemented; a question" by Autrijus Tang
Autrijus Tang  
View profile  
 More options Mar 6 2005, 12:17 pm
Newsgroups: perl.perl6.compiler
From: autri...@autrijus.org (Autrijus Tang)
Date: Mon, 7 Mar 2005 01:17:35 +0800
Local: Sun, Mar 6 2005 12:17 pm
Subject: array interpolation implemented; a question

On Sat, Mar 05, 2005 at 02:39:06PM -0700, Luke Palmer wrote:
> Garrett Rooney writes:
> > Garrett Rooney wrote:

> > >Assuming the spec is correct, here's a patch to add some more tests to
> > >t/op/string_interpolation.t.

> > Of course, those should have been todo_is tests...  Here's the right patch.

> Thanks, applied.

Thanks, implemented as such (r579).

With that change however, these three lines are now the same:

    my @x = @a;
    my @x = @a[];
    my @x[] = @a;

Is that correct?

Thanks,
/Autrijus/

  application_pgp-signature_part
< 1K Download

    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.
Garrett Rooney  
View profile  
 More options Mar 6 2005, 12:30 pm
Newsgroups: perl.perl6.compiler
From: roo...@electricjellyfish.net (Garrett Rooney)
Date: Sun, 06 Mar 2005 12:30:43 -0500
Local: Sun, Mar 6 2005 12:30 pm
Subject: Re: array interpolation implemented; a question

I believe so, since @x[] is an array slice that encludes the entire
contents of the array.

-garrett


    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.
Larry Wall  
View profile  
 More options Mar 7 2005, 3:27 am
Newsgroups: perl.perl6.compiler
From: la...@wall.org (Larry Wall)
Date: Mon, 7 Mar 2005 00:27:40 -0800
Local: Mon, Mar 7 2005 3:27 am
Subject: Re: array interpolation implemented; a question
On Sun, Mar 06, 2005 at 12:30:43PM -0500, Garrett Rooney wrote:
: Autrijus Tang wrote:

: >On Sat, Mar 05, 2005 at 02:39:06PM -0700, Luke Palmer wrote:
: >
: >>Garrett Rooney writes:

: >>
: >>>Garrett Rooney wrote:

: >>>
: >>>
: >>>>Assuming the spec is correct, here's a patch to add some more tests to
: >>>>t/op/string_interpolation.t.
: >>>
: >>>Of course, those should have been todo_is tests...  Here's the right
: >>>patch.
: >>
: >>Thanks, applied.
: >
: >
: >Thanks, implemented as such (r579).
: >
: >With that change however, these three lines are now the same:
: >
: >    my @x = @a;
: >    my @x = @a[];
: >    my @x[] = @a;
: >
: >Is that correct?
:
: I believe so, since @x[] is an array slice that encludes the entire
: contents of the array.

Yes, it's taken as a 0-dimensional slice, rather than a 1-dimensional
slice with 0 selected elements.

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

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