On Tue, 2004-08-24 at 08:00 -0400, Matt Frye wrote: > Copying _doesn't_ count, but Mike seems to at least understand > Jensen's Device. > > The key is pass-by-name parameter passing, whereby argument > expressions are compiled to parameterless procedures - the infamous > "thunk." Thunks can be passed into a called procedure to re-evaluate > the argument. > > Good stuff.
However, to be pedantic, Jensen's device isn't a synonym for call by name, but rather a specific use of call by name to implement a generic summation function. It's interesting in that it points out the differences between call by name and call by reference (the way early Fortran* did it) and call by value, which is the way most languages designed since C work**. * I once spent a frustrating period trying to debug a stubborn Fortran II program. It wasn't until I realized that the "constant" 2 had changed after passing it as a parameter to a subroutine that I twigged on the subtleties of pass by reference. ** I'd also argue that today's object-oriented languages have also added a new linkage semantics of pass by object reference. Also you can of course pass a reference in C as a value, but at least you've got a clue of what's going on when you have to explicitly dereference it.
signature.asc
Description: This is a digitally signed message part
-- TriLUG mailing list : http://www.trilug.org/mailman/listinfo/trilug TriLUG Organizational FAQ : http://trilug.org/faq/ TriLUG Member Services FAQ : http://members.trilug.org/services_faq/ TriLUG PGP Keyring : http://trilug.org/~chrish/trilug.asc
