Larry Wall wrote:
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,

Huh.  I'm not used to this happening.  So what would the following
code do, and why?

   my @b = ('foo', 'bar');
   my $x = @b;
   say $x;

likewise

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

gives you the original array as well.

Err... don't you mean '@$x' instead of '@$a'?

: >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.)

???

There's some potential non-dwimmery here - either that, or there's a
steep learning curve (that I haven't mastered) before dwimmery can be
applied[1].  I would expect $|x to refer to the scalar slot of the
capture object |x; as such, '$|x := ...' would mean 'bind the scalar
slot of |x to ...'.  Likewise, I would expect '... := $a' to mean
'bind ... to the scalar variable $a'.

Or is the distinction between '$a' and 'the contents of $a' similar to
the distinction between a Unix filename and a Unix file ID?  That is,
are we talking about the difference between hard links and symbolic
links in Unix?

--
Jonathan "Dataweaver" Lang

[1] I'm not sure that there's much of a difference between the two statements.

Reply via email to