Proposed change to Dynamic library: mark it unsafe

Marcin 'Qrczak' Kowalczyk
21 Aug 2001 10:14:28 GMT

20 Aug 2001 15:46:04 -0600, Alastair David Reid <> pisze:

> An obvious fix would be to change the method name from "typeOf" to
> "unsafeTypeOf" - reflecting the fact that a bad definition breaks type
> safety and can lead to segmentation faults.  But this wrongly labels
> uses of typeOf as being unsafe when it's definitions which are
> (potentially) unsafe.

Wouldn't be possible to make Dynamic derivable or something (better:
with a magic default definition of typeOf, so the instance can be
made after the type definition)?

If the compiler could figure out a good definition itself, it would
not only solve the safety problem, but made using Dynamic easier:
I always have to look up how a Dynamic instance should look like.

Yes, it requires magic in the compiler, but Dynamic is already
unimplementable in standard Haskell.

 __("<  Marcin Kowalczyk *
  ^^                      SYGNATURA ZASTĘPCZA