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

Re: dynamic vs. static typing



At 9:01 PM +0100 11/20/03, Jakub Travnik wrote:
>From: "Anton van Straaten" <anton@appsolutions.com>
>Subject: RE: dynamic vs. static typing
>Date: Thu, 20 Nov 2003 14:06:02 -0500
>
>>  Joe Marshall wrote:
>>  The Haskell example I referenced includes the enumeration of a number of
>>  seemingly trivial identity relationships, such as "Monday == Monday", i.e.
>>  specifying, for the benefit of a type definition, "whether an object is
>>  identical to itself".
>
>Moreover assignment itself and value passing can be part of its
>interface. Values in many languages have different behavior when
>passed or assigned depending on type. In C++, class can specify
>assignment operator. In Lisps some values are passed by reference and
>others by value - and that is really different behavior. Some other
>values (not only common ones like numbers) can have single instance
>semantic too.

No, no, no.  In Lisp, all parameters are passed by "object
reference" (*).  Some of these objects are mutable, so you
can change "parts" of them.  Integers happen to be immutable,
so there's no part of it you can change.

People constantly get confused about this because so many
Lisp implementations have tagged integers that "feel like"
they are being passed by value.  But they aren't -- those
are just an efficient way of doing the object reference.

----------
(*) Really, passing by "object reference" is the same as
passing by value, but I (and others) use this term so as
to avoid the by-value/by-reference terminology quagmire.