cvs commit: hugs98/src builtin.c
Alastair Reid
reid@glass.cse.ogi.edu
Sun, 1 Apr 2001 21:24:13 -0700
reid 2001/04/01 21:24:13 PDT
Modified files:
src builtin.c
Log:
This is a bogus commit because I just accidentally committed all files
instead of just machdep.c (and I can't remember the cvs magic to undo
it).
So here's what all those committed files did:
interns.c:
The old file interns.c (which is usually ifdef'd out) provides access
to a bunch of Hugs internals. This provided a primitive:
catchException2 :: a -> Either Cell a
where Cell is an error object. The only change here is a fix to the
implementation. It couldn't possibly work the way it was - which
leaves me wondering what happened to it.
builtin.c:
Put a (fixed) copy of catchException2 here and added throwException
data HugsException
primitive primCatchException :: a -> Either HugsException a
primitive primThrowException :: HugsException -> a
Note that using these directly would break referential transparency.
To fix that, one or the other (doesn't matter) ought to be in the IO
monad. But there's difficult interactions with the thread
implementation (that's what the fuss is about after all!) so we
provide the unsafe versions here and wrap them up before exporting
them.
Incidentally, notice that these names (which have to be exported from
the Prelude and so pollute the user's namespace) either include the
word "hugs" or starts with the word "prim".
printer.c:
Added a primop for printing Hugs exception objects
primitive primShowException :: HugsException -> String
It originally had type:
primitive primShowException :: HugsException -> ShowS
but printDBadRedex ignores its second argument when printing error
objects.
Revision Changes Path
1.12 +3 -3 hugs98/src/builtin.c