Fri, 4 Feb 2000 18:55:18 +0300 (MSK), S.D.Mechveliani <[EMAIL PROTECTED]> pisze:

> Indeed, I had met a couple of times in practice that forgetting of
>     import <CertainModule> ...
> may lead to successful compilation and the un-desired change of 
> computation result at the run-time! 

I think it's hard to avoid with overlapping instances. The semantics of
overlapping instances are simply not nice: they say that a definition
applies *unless* the type has certain properties. This is strange in
itself, and I would accept it only when in such case there is another
definition which gives the same result more efficiently (in such case
forgotten imports won't cause errors, only inefficiencies).

If the result was different after adding imports, it's a symptom of an
error in the design of particular classes, or maybe other deficiencies
of the class mechanism itself. IMHO overlapping instances don't fit
well the current model.

Current meaning of type properties is not closed under negation, and
BTW now I feel that the fact that in programming in logic negation
causes troubles is not so strange. There is a substantial difference
between "the type does support the Hashable interface" and "the type
does not support the Hashable interface". Supported operations on a
type should be monotonic wrt. interfaces the type provides. Adding
a type to a class should not restrict what we can do with values of
that type, or cause previously working function to fail, or to change
its meaning.

With the unfortunate exception of ambiguities causing errors, because
they are unavoidable in our type system. Can't define the same thing
twice, and it would be too restrictive to limit places where instances
can be defined. It requires some discipline to ensure that instances
are not duplicated. If a type could have various instances of a class,
probably the implementation should be passed explicitly instead of
through a class - classes are for cases when there is only one natural
implementation for a type.

-- 
 __("<    Marcin Kowalczyk * [EMAIL PROTECTED] http://qrczak.ids.net.pl/
 \__/              GCS/M d- s+:-- a22 C+++$ UL++>++++$ P+++ L++>++++$ E-
  ^^                  W++ N+++ o? K? w(---) O? M- V? PS-- PE++ Y? PGP+ t
QRCZAK                  5? X- R tv-- b+>++ DI D- G+ e>++++ h! r--%>++ y-

Reply via email to