Unsafe
structureThese modules provide unsafe access to data structures and to runtime-system functions. Use of Unsafe by an ML program can cause corruption of the ML execution, which may lead to program crashes or other insecurity.
signature UNSAFE
structure Unsafe
: UNSAFE
structure CInterface : CINTERFACE
structure Object : UNSAFE_OBJECT
structure Poll : POLL
structure Vector : UNSAFE_VECTOR
structure Array : UNSAFE_ARRAY
structure CharVector : UNSAFE_MONO_VECTOR
structure CharArray : UNSAFE_MONO_ARRAY
structure Word8Vector : UNSAFE_MONO_VECTOR
structure Word8Array : UNSAFE_MONO_ARRAY
structure Real64Array : UNSAFE_MONO_ARRAY
val getHdlr : unit -> 'a cont
val setHdlr : 'a cont -> unit
val getVar : unit -> 'a
val setVar : 'a -> unit
val getPseudo : int -> 'a
val setPseudo : ('a * int) -> unit
val blastRead : Word8Vector.vector -> 'a
val blastWrite : 'a -> Word8Vector.vector
val boxed : 'a -> bool
val cast : 'a -> 'b
val pStruct : Object.object ref
val topLevelCont : unit cont ref
getHdlr ()
exn cont
, that is, a continuation taking an exception as an argument. (There seems to be no reason for the type to be 'a cont
in this signature.) Throwing an exn
to this continuation will behave as if the exception were raised.
There is nothing inherently unsafe about this (except the bogus use of 'a cont
in the signature instead of exn cont
. It is even possible to grab the handler, then leave the dynamic scope of the handler, then throw to it, with paradoxical but not unsafe effect.
setHdlr k
exn cont
, as the current exception handler.
getVar ()
setVar a
getPseudo i
setPseudo (a, i)
blastRead vec
blastWrite a
boxed a
cast a
pStruct
topLevelCont