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');

Reply via email to