Re: Glasgow haskell vs. Lispworks
- From: Rainer Joswig <joswig@xxxxxxx>
- Date: Sat, 11 Aug 2007 23:02:11 +0200
In article <1186864875.060177.110990@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
rossberg@xxxxxxxxxxxx wrote:
On 11 Aug., 14:22, Rainer Joswig <jos...@xxxxxxx> wrote:
* identity (is this really the same thing?)
* value (does it have the same value?)
* structural (does is have the same structure?)
* fuzzy (is it same up to some limit?)
and so on.
Neither of these does The Right Thing in general. E.g. when you have
data structures that are largely structural, but contain a few mutable
nodes somewhere inside (say a tree carrying some mutable infos). The
right thing would be choosing different notions of equality on
different nodes. SML and Haskell do that automatically, thanks to
typing. E.g. in SML,
val r = ref 1
[r, r] = [r, r] (* true *)
[r, r] = [r, ref 1] (* false *)
Note that the lists are compared structurally, while the contained
references are compared by identity - which is the only definition of
equality properly mirroring observational equivalence.
strings
* "foo" and "foo", same strings ?
are these really the same objects?
* "foo" and "foo", same contents ?
It could be different string types (fixed length, growing strings,
unicode strings, ascii strings, ...)
* "foo" and "Foo", same word?
* "Rainer Joswig" and "Ranier Joswig", same name (minus spelling)?
Haskell denies you this particular flexibility, but in exchange you
gain the ability to have compiler discover your intentions using the
types of your terms. Pairs, lists and trees all have distinct types,
and Haskell can use the appropriate comparison function automatically.
The compiler can't discover my intentions. That would be AI.
I'm confused. Is that a proof that SML and Haskell do not exist?
Choosing the appropriate comparison function does not depend on
the types of the arguments, but on the intentions of what
features of two objects I want to compare how.
.
- Follow-Ups:
- Re: Glasgow haskell vs. Lispworks
- From: Joachim Durchholz
- Re: Glasgow haskell vs. Lispworks
- From: rossberg
- Re: Glasgow haskell vs. Lispworks
- From: Matthew Danish
- Re: Glasgow haskell vs. Lispworks
- From: jsnX
- Re: Glasgow haskell vs. Lispworks
- References:
- Glasgow haskell vs. Lispworks
- From: Rene de Visser
- Re: Glasgow haskell vs. Lispworks
- From: Rainer Joswig
- Re: Glasgow haskell vs. Lispworks
- From: Stuart Cook
- Re: Glasgow haskell vs. Lispworks
- From: Rainer Joswig
- Re: Glasgow haskell vs. Lispworks
- From: rossberg
- Glasgow haskell vs. Lispworks
- Prev by Date: Re: Glasgow haskell vs. Lispworks
- Next by Date: Re: Glasgow haskell vs. Lispworks
- Previous by thread: Re: Glasgow haskell vs. Lispworks
- Next by thread: Re: Glasgow haskell vs. Lispworks
- Index(es):
Relevant Pages
|