[pugs] array interpolation question

2005-03-05 Thread Garrett Rooney
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
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 ([EMAIL PROTECTED]) { [EMAIL PROTECTED] }
 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');


Re: [pugs] array interpolation question

2005-03-05 Thread Garrett Rooney
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
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 ([EMAIL PROTECTED]) { [EMAIL PROTECTED] }
 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');


Re: [pugs] array interpolation question

2005-03-05 Thread Patrick R. Michaud
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



Re: [pugs] array interpolation question

2005-03-05 Thread Luke Palmer
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