[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: dynamic vs. static typing
[Joe Marshall <jrm@ccs.neu.edu>]
>
>
> > Joe Marshall wrote:
> >>
> >> Er, yes, but whether an object is identical to itself isn't usually
> >> considered a property or interface of the object.
>
> "Anton van Straaten" <anton@appsolutions.com> writes:
> > Then I'd argue that those doing the "usual considering" are missing
> > something important. The fact is, equality is an operation on values, which
> > makes it part of the interface to those values. Many languages recognize
> > this explicitly, because they have to, to get their semantics right.
> > Haskell, C++, and Smalltalk all explicitly define equality as part of the
> > interface of a type or class.
>
> *some* `kinds of equality' are certainly part of the interface, but
> intensional identity is generally an axiom of logic. The language may
> not give you access to the concept and make you define your own
> isomorphic version (like defining Monday == Monday), but that's a bug
> in the language design.
I would argue the exact opposite. I'd say that the kind of identity
you're referring to is really an implementation detail of the run-time
system. Exposing this kind of implementation detail seems more like a
bug in the language design to me. Hence all the pitfalls and caveats
surrounding the use of this feature in languages that provide it (==
in Java, eq? in Scheme, and so on). It's almost never a meaningful
notion of equality.
Even if there is good reason to provide it, I don't understand your
argument that it shouldn't be conceived of as part of the interface of
values in the given language. In fact, that's exactly how it's
represented in Java, which is why, for example, the following is a
type error:
if (5 == new Object()) ...;
>
> > So this is all an argument in favor of easy to use
> > parameterized types. :)
>
> Yes.
Amen. (And let's be glad that this particular branch of this thread
hasn't yet degenerated into a holy war about email clients. Isn't
there some kind of Universal Law of Usenet about all arguments
eventually ending that way? And yes, I use mutt. Haha...)
My favorite result of this entire thread is the nice partition of
opinions regarding types in programming languages. I feel very much
more secure in myself now that I can just say, "I'm a Type 4..." ;)
Matt
--
Matt Hellige matt@immute.net
http://matt.immute.net