On Fri, Sep 22, 2006 at 12:32:27AM -0700, Jonathan Lang wrote:
: Larry Wall wrote:
: >Jonathan Lang wrote:
: >: Two questions:
: >:
: >: 1. How would the capture sigil affect the use of capture objects as
: >: replacements for perl5's references?
: >
: >I don't see how it would have any effect at all, unless the P5 ref happened
: >to be to a typeglob, or had both array and hash semantics tied to it.
: >The regular $$x, @$x, and %$x look much like they do in P5.
: 
: But $x is a scalar; wouldn't you need to use '|x' to denote a capture
: object, thus making the above '$|x', '@|x', and '%|x', respectively?

You don't need to use | to store a capture any more than you need @ to
store an array.  Just as

    $x = @b;
    @$x;

gives you the original array, likewise

    $x = [EMAIL PROTECTED];
    @$a;

gives you the original array as well.

: >we currently don't allow assignment to a capture, only binding.
: 
: IOW, if you want someone to be able to say '$|x' and get '$a' as a
: result, you'd have to say '|x := \$a' (or perhaps '$|x := $a') instead
: of '|x = \$a'.  Right?

Yes.  That's how it's currently specced, anyway.  (The \ is probably
required, or it'll try to bind to the contents of $a instead.)

Larry

Reply via email to