>However, consider this in a different light for a moment:
> $a = "MyClass";
> *a = MyClass->generate; # ask for ref back
> $a->blah;
> *a->blah; # use our ref
>Whether or not having to care about your refs is good or bad depends on
>which way you look at it. In one case, it's bad if you don't want to
>have to care at all. On the other hand, what if you don't want to care,
>and MyClass->generate returns "5"? This probably won't work. So you do
>want to care, at least a little, and * helps with this by doing implicit
>ref sanity checks for you.
Perl already does the sanity check for you: "can't call method
without package or reference". What you're saying requires the
programmer to diddle about, which is never a win.
>For example, here you know roughly what you're addressing:
> $a[0][1] # element of array
> $h{key} # element of hash
>Why not make that easier still?
> print $this # "true" scalar
> *a[0]->func # first element (ref) of @a
> *h{key}->func # key element (ref) of %h
And just what about that is easier than the good old way. I *know*
what I'm addressing when those are written normally. I'm addressing at
the level of complexity that works.
>You can already tell hashes and arrays apart, why not references vs.
>simple scalars?
I *can* tell them apart: can't you? If ref...
Beyond that, why should an array of strings be treated differently
from an array of references? This is one of Perl's masterful
unifications. Constrast this with annoying languages where you
have to be overly anal about typing.
>> You introduce bizarre *foo[$i] syntax. Why should that be
>> any different than $foo[$i]?
>First, just because it's new doesn't necessarily make it bizarre. :-)
>The only syntactic difference between the two is the prefix - * vs. $.
>The * is used to explicitly address a reference, just like @ explicitly
>addresses an array.
When you say @{ ... }, you are specifically "addressing a reference",
as you put it. Likewise when you say $blah->[ ... ]. It requires no
extra mollycuddling.
Dollar means one thing -- singular.
At sign means many things -- plural.
(Percent means an assocation of things -- perhaps genitive/possessive.
Now you can have a list of singular things, where you don't have
to get all uptight about whether some of those things are primes,
others are unicode strings, and still others are socket connections.
This is clean and simple.
>It's also less obtuse that this, since -> connotes an "action" to many:
> $hash{key} # non-action
> $$hash{key} # non-action
> $hash->{key} # action??
> $*hash{key} # non-action
It *does*? To whom? And why do we care?
I just don't see any issue here.
--0tom