> I have an slight aversion to implicit dereferencing, and a stronger
> aversion to breaking old code.
Well, it's probably wrong to wedge C++-like references into Perl, but
that isn't what I mean. Perl has 'value' semantics, and
Lisp/Scheme/Dylan have more or less 'reference' semantics. There
isn't anything I'd call "implicit dereferencing" because it's
impossible to ever see a naked reference. In Perl, you can have a
list Right Here (in a @something variable) or you can have a list
Somewhere Else (with a reference). In Lisp et al you don't have the
choice.
> : $$sref to use a reference to a scalar, @$ref to use a reference to an
> : array, and %{$ref} to use a reference to an assoc. array just aren't
> : pretty to my delicate eyes.
> I don't know why you only put the curlies on the hash reference--that's
> really independent of type. %$ref works just as well as %{$ref}.
It was a bad edit. I had curlies around all of them, but thought it
was unfairly punctuational. You need them sometimes, but not always,
so I decided to take them out, and in my addled state, missed one.
> In fact, most of the time, they aren't going to use references at
> all.
Really? Let's say I have a function that takes two lists. It's
either going to take references or type globs, and references are the
clear winner in most cases.
I think it's always going to be confusing to people that argument
passing coalesces all the arguments into one big list with no
discernible boundaries.
> those languages where you have to learn the whole language before
> you can use any of it. And then it would no longer be Perl.
I think there are very few languages like that. C++ is guilty, but I
use many languages about which I don't know everything (obviously).
Just for my information, could you tell me some of the others?
> I've already announced that Perl 5 will have some form of operator
> overloading, so you'll be able to say $a + $b. Even now, though,
> you can say
>
> add $a $b
>
> which seems pretty durn uncluttered to me.
Duh. Thinko. I knew I shouldn't have argued. In my defense,
although I contributed several fixes to perl5 and I wrote the Linux
dynamic loader, I've written exactly *one* perl5 program and that was
back in the early alpha days. I knew about the other method syntax,
but I was trying to make a point; I guess that knowledge didn't feel
like interfering.
Hey, it's Perl. There's got to be more than one way to invoke
methods. I really don't mean to bash Perl. I'm just trying to point
out some of the nuances that might be unnecessarily interesting in a
teaching language.
Since we're on the subject of overloading, will there be a way to
specify a function to give the string representation of an object?
I'd like to be able to use simple interpolation (print "answer was
$a") instead of some more explicit function call of a's print method.
-- Robert