Proposed change to Dynamic library: mark it unsafe

Marcin 'Qrczak' Kowalczyk qrczak@knm.org.pl
21 Aug 2001 10:14:28 GMT


20 Aug 2001 15:46:04 -0600, Alastair David Reid <reid@cs.utah.edu> 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 * qrczak@knm.org.pl http://qrczak.ids.net.pl/
 \__/
  ^^                      SYGNATURA ZASTĘPCZA
QRCZAK