On Friday, July 4, 2003, at 10:56 , Dan Sugalski wrote:

This, of course, brings up the question of who gets to decide whether things are passed by value or reference, the caller or callee, so I'm up for discussion on that.

Isn't this again a function of the routine's signature? The callee ought to indicate whether it wishes a reference or not, and the caller in turn must be bound to conform to that contract. So my answer to this question would be that both are responsible for conforming to the signature dictated by the called routine. Admittedly not in keeping with Perl 5 (aliased @_), but in keeping with the Apocalypses: Perl 6 arguments will be passed by value unless is rw is specified, meaning that the prototype must be examined, either at run- or compile-time, in order to make the decision.


The alternative: Pass all parameters by reference all the time and have the callee make copies when it wants a by-value parameter. Optimizer hell. Probably bad for locality of reference. Potentially good for performance if the average argument is larger than a pointer type, though.



Gordon Henriksen
[EMAIL PROTECTED]

Reply via email to