Larry Wall skribis 2005-04-06 11:37 (-0700):
> :     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.

If Perl 6 is really to stay Perl, then "can't" is wrong.

This is a very basic thing that should have equally basic syntax. There
must be a way to get at $bar, because otherwise $bar's properties cannot
be accessed. The var() thing, or whatever it will be spelled eventually,
must exist for a reason: sometimes you want the reference. For the
same reason, the reference at any level should be reachable, to be able
to set its properties. Or, and that's what I'm concerned about more, to
assign it a new value.

And of course there must be some way to translate Perl 5 code.

> Chains of scalar refs are weird.  At least, they're weird to anyone but
> a C programmer or a Perl 5 programmer. 

I have always found chains of scalar references to be very easy to use
and understand, even when I first learned about them. I cannot imagine
that they are weird to anyone, and have in the years that I've been
helping people out on Perl Monks and in several IRC channels, never seen
anyone express a negative opinion about them. References are kepts very
simple in Perl 5 and that's what makes them easy to use. The difference
between references and aliases works very well, and keeps the separation
of identifiers, containers and values explicit, superficial and clear.

Implicit dereferencing where no ambiguity can be, like with arrays and
hashes, is fine, but IMO implicitly dereferencing scalars fees terribly
wrong. It would feel less wrong if Array and Hash were subtypes (or
whatever it's called) of Scalar, as Str and Num are, but then I'd start
to want a non-Perl name for Perl 6 again, because the language would
just not be Perl anymore.


Reply via email to