Larry Wall wrote:

On Wed, Apr 06, 2005 at 08:24:23PM +0200, Juerd wrote:
: Larry Wall skribis 2005-04-06 11:10 (-0700):
: > $$ref follow the ref list to the actual object.
: : my $foo;
: my $bar = \$foo;
: my $quux = \$bar;
: my $xyzzy = \$quux;
: : How then, with only $xyzzy, do you get $bar? $$xyzzy would follow until
: $foo. I don't like this at all.

You can't get at $bar anyway.  You can only get at its thingy.  Otherwise
you're talking symbolic refs.

: > $ is one of those contexts that forces a deref. The only way
: > to call methods on the Ref itself is through var($ref), or whatever
: > it's called today.
: : This is weird.

Chains of scalar refs are weird. At least, they're weird to anyone but
a C programmer or a Perl 5 programmer. We're trying to re-Huffmanize
the weirdness of Perl 6.

How do you deref 'n' levels in such a chain?

My current project is a n-way merge of some very large {i.e., O(10**8) records} XML datasets. One way I'm getting performance is by using scalar reference chains to avoid copies. I am also recasting the type of some of the objects used, so I need to be able to reach in 'one' level, as well as 'all' the levels. Currently, I have to know the length of the chain, but it's a constant at any layer so that's not a problem.

So if $$ref gives the 'all the way down' behavior, how do I get "just one layer down" dereferencing?


Reply via email to