Calling Conventions and Pass By Reference
Randy J. Ray
rjray at blackperl.com
Tue Sep 2 19:34:42 BST 2008
> What other subtleties am I missing? What are the pros and cons from a
> language and culture perspective? From an underlying implementation and
> internals perspective?
Well, the first thing that occurs to me is that every variable access is now a
dereference, which is going to be very wasteful for read-only parameters. In
Java for example (yeah, yeah... "boo! hiss!") using the "final" modifier on a
parameter allows for some decent optimization. So much so that pretty much
every static-analysis tool I've used (PMD, Eclipse built-in rules, etc.) flags
any method parameters and local declarations that *could* be declared final but
aren't. It's one of the first concepts in the ORA book, "Better, Faster,
Lighter Java".
I would also consider the actions-at-a-distance threat to be pretty
significant. I don't want to have to worry about that sort of thing in a
3rd-party component.
Randy
--
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Randy J. Ray Silicon Valley Scale Modelers: http://www.svsm.org
rjray at blackperl.com
randy.j.ray at gmail.com
More information about the london.pm
mailing list