Re: [pugs] array interpolation question

13 views
Skip to first unread message

Patrick R. Michaud

unread,
Mar 5, 2005, 11:39:45 AM3/5/05
to Garrett Rooney, perl6-l...@perl.org, perl6-c...@perl.org
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

Garrett Rooney

unread,
Mar 5, 2005, 11:25:09 AM3/5/05
to Garrett Rooney, perl6-l...@perl.org, perl6-c...@perl.org
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

Garrett Rooney

unread,
Mar 5, 2005, 11:42:17 AM3/5/05
to Patrick R. Michaud, perl6-c...@perl.org
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

Patrick R. Michaud

unread,
Mar 5, 2005, 11:41:56 AM3/5/05
to Garrett Rooney, perl6-c...@perl.org
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

Garrett Rooney

unread,
Mar 5, 2005, 11:22:23 AM3/5/05
to perl6-l...@perl.org, perl6-c...@perl.org
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

Patrick R. Michaud

unread,
Mar 5, 2005, 11:58:53 AM3/5/05
to Garrett Rooney, perl6-c...@perl.org

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

Luke Palmer

unread,
Mar 5, 2005, 4:39:06 PM3/5/05
to Garrett Rooney, perl6-l...@perl.org, perl6-c...@perl.org

Thanks, applied.

Luke

Autrijus Tang

unread,
Mar 5, 2005, 4:18:50 PM3/5/05
to Patrick R. Michaud, Garrett Rooney, perl6-c...@perl.org
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/

Autrijus Tang

unread,
Mar 6, 2005, 11:00:02 AM3/6/05
to Luke Palmer, perl6-c...@perl.org
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/

Autrijus Tang

unread,
Mar 6, 2005, 12:17:35 PM3/6/05
to Luke Palmer, perl6-c...@perl.org
On Sat, Mar 05, 2005 at 02:39:06PM -0700, Luke Palmer wrote:

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/

Garrett Rooney

unread,
Mar 6, 2005, 12:30:43 PM3/6/05
to Autrijus Tang, Luke Palmer, perl6-c...@perl.org

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

-garrett

Larry Wall

unread,
Mar 7, 2005, 3:27:40 AM3/7/05
to perl6-c...@perl.org

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

Larry

Reply all
Reply to author
Forward
0 new messages