On Wed, Sep 20, 2006 at 05:18:12PM -0400, Aaron Sherman wrote:
: Consider this the first test of the first-classness of objects in Perl
: 6. You have an object that's something not entirely unlike:
:
: class Capture { has $.scalar; has @.array; hash %.hash }
:
: I think the addition of a sigil is the wrong way to go for several
: reasons, but most important among them is that there are going to be a
: lot of scalars that contain objects that are awfully capture-like, and
: they'll need whatever semantics we deem appropriate for captures too.
I don't see how that follows. There will be lots of objects containing
lots of things that don't give a rip about having a capture interface.
: For this reason, I'd suggest putting away the Latin-1 glyphset and
: instead focusing on developing operators to act on containers with
: multiple access methods and their expanded forms.
There's already going to be such an operator, and it probably won't be
Latin-1. The only question in my mind is whether it's also a sigil.
: First of all, I need a word. I'm going to call an expanded capture a
: "signature" even though that's a bit too metaish. I don't encourage
: others to use this term, but it helps me to get my head around this.
That's not a good choice of term, since signatures already mean something
else entirely in Perl 6.
: A signature is a bit like a list. It has no data type that you can point
: to directly. Signatures are also probably lazy like lists.
What you're calling a signature is in fact just another capture in our
terminology.
: When we want to turn a capture that is stored in a scalar into a
: signature, we need an operator that performs that action, and
: unambiguously does NOT perform the action of turning it into a list. I
: suggested some in my previous message (such as <-- and $\).
The Style Police have rated those as slightly less ugly than [,]=.
: Subroutines just so happen to take signatures, so you can invoke them
: with one:
:
: foo(<-- $capture);
: foo($\ $capture);
That's foo(|$capture) now.
: Now, you need to be able to go in the other direction. You need to be
: able to assemble a signature and convert it into a capture. This, we
: already have:
:
: $cap = \(<-- $othercap, $a, :$b)
: $cap = \($\ $othercap, $a, :$b)
:
: This would transform $othercap from a capture to a signature, add in a
: positional and a named value and then re-integrate the resulting
: signature as a new capture.
In my current thinking that's just \( |$othercap, $a, :$b ).
: Calling subroutines with such a thing looks nice and clean:
:
: $values = \([EMAIL PROTECTED], [EMAIL PROTECTED], $c, :mean<1>);
: $avg1 = avg(<-- $values, :undef<ignore>);
: $avg2 = avg(<-- $values, :undef<iszero>);
:
: That's as simple as you can get, and we didn't have to promote captures
: to a new kind of sigil type to do it.
I think | is a lot nice-and-cleaner and simpler than <--. And it
can also work as a sigil.
Larry