[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] why address called reference?



Xah Lee writes:
|Why does Perl call memory address references? e.g. "$xx is a reference to
|an array", instead of "$xx is an address of an array".

I suspect only Larry or Tom or one of those guys can give you the real
reason. However, I can guess at a few:

- A reference isn't an address. Just because it looks like one is only
an implementation detail. In fact, if you print a reference and then use
the hex number in it as an address in Macsbug, you won't see your data
(I think, it's been a while since I played with the perl5 source).

- A reference is more than an address, it's type information as well.
"Address" as used in C/C++ or assembly language doesn't have any type
information associated with it.

- To avoid confusion with those C/C++ and assembly language uses of
"address". If they'd called it an address, people would expect to be
able to do "address"-type things with it--casting, pointer arithmetic,
etc. By calling it something else, people actually have to read about
what they can do with it instead of assuming what they can do with it
and then getting mad at Larry et al. when their assumptions prove
wrong. :-)

Brian

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch