Thu, 30 Sep 1999 02:08:23 +1000, Fergus Henderson <[EMAIL PROTECTED]> pisze:

> > I only don't like the details about IOError. It's not extensible
> > and Dynamic is still not nice. I have no idea how to make it
> > better. Probably some general way of making extensible datatypes.
> 
> Could you explain what you don't like about Dynamic?

The implementation relies on mkTyCon used in the top level definition;
no referential transparency. Fixing it would begin to rely on manual
invention of unique names. This could fail when the same type name
is used in different modules.

One must know the exact type inside to do anything with it. One cannot
make a singleton list of the value inside Dynamic and put the result
into Dynamic without knowing its type. One cannot declare that all
values in a particular Dynamic are in some class and apply methods
of that class to them without knowing their types.

Errors in describing the types will result in dangerous behavior of
using some value after unsafeCoercing it to an incorrect type.

One cannot describe more elaborate type constructs, like local
universal quantification. Fortunately they may always be put into
separately named datatype, it's not that bad.

At last, there is this explicit Typeable class. Making its instance
is a non-creative technical issue.

Disclaimer: I have not used Dynamic in practice. Maybe it is more
useful than ugly. But I think that most uses of Dynamic are symptoms
of some lacking capabilities in the type system.

-- 
 __("<    Marcin Kowalczyk * [EMAIL PROTECTED] http://kki.net.pl/qrczak/
 \__/          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