On Wed, Jul 21, 2004 at 06:25:46AM +0400, Alexey Trofimenko wrote:
: some questions:
: 
: 1) is "@a[1][2]{'a'}«b»" interpolateable?

Yes.

: and what about "@a[1]('arg')[3]"?

I can argue that both ways, but overall it seems like it won't cause
much of a problem, and keeps () in the same mental category as []
and {}.  So probably yes.

: 2) what's the default separator for list interpolation?
:   "{1,2,3}" eq "123"   or
:   "{1,2,3}" eq "1 2 3" ?

Space would be what a Perl 5 programmer would expect, and is often what
you want.  Though there's also an argument that the default should
be "[1,2,3]".  But I think we need to force use of a .repr for that.

: and is there any way to redefine it, as assigment to perl5 @" does?

You mean $", I presume.  We had said that the default interpolation
separator could be set as a trait of an array.  That's a bit of a
problem if the array only knows it's being part of a list, and doesn't
know that that list is being interpolated.  However, maybe we should
allow interpolation of a bare @foo if is predeclared with a separator
(and maybe we could default to adding brackets the same way).
Likewise bare %foo could interpolate if predeclared with a method of
writing pairs and separators (and maybe brackets).

This is a little like the faulty Perl 4 rule of interpolating arrays
only if they'd been used, but in Perl 6 this would only be lexically
scoped, since the default would be attached to the array declaration,
and that would cause much less confusion than the Perl 4 rule.

Alternately, properties on the object itself could be used, but that
doesn't help us decide whether to interpolate bare @foo or %bar,
or whether to use separators or not.

: I can't figure to which object or class that property could belong, so maybe  
: there should be just lexically scoped pragma...

Lexical declarations would most naturally attach to the variable
declaration in question, unless you want a pragma to affect all
subsequent syntax.  But maybe it's just better to huffmanize the code
to specify the separator in line.  We currently have

    [EMAIL PROTECTED] ':'}

for that, but maybe we can shorten it further.

Larry

Reply via email to