Standard ML of New Jersey


The UNSAFE_OBJECT signature


Synopsis

signature UNSAFE_OBJECT

Interface

type object
datatype representation
  = Unboxed
  | Real
  | Pair
  | Record
  | PolyArray
  | ByteVector
  | ByteArray
  | RealArray
  | Susp
  | WeakPtr
val toObject : 'a -> object
val boxed : object -> bool
val unboxed : object -> bool
val rep : object -> representation
exception Representation
val toTuple : object -> object vector
val toString : object -> string
val toRef : object -> object ref
val toArray : object -> object array
val toExn : object -> exn
val toReal : object -> real
val toInt : object -> int
val toInt32 : object -> Int32.int
val toWord : object -> Word.word
val toWord8 : object -> Word8.word
val toWord32 : object -> Word32.word

Description

type object
An abstract type for SML values, from which their representation may be interrogated.

datatype representation

toObject a
View any value as an object.

boxed ob
Does ob have a boxed (pointer) representation?

unboxed ob
Does ob have an unboxed (tagged, nonpointer) representation?

rep ob
What is the representation of ob?

exception Representation

toTuple ob
If ob is a record, tuple, vector, or real-array, get a vector of its fields; otherwise raise Representation.

toString ob
If ob is really a string, get its string value; otherwise raise Representation.

toRef ob
If ob is really a ref or an array of length 1, view it as a ref, otherwise raise Representation.

toArray ob
If ob is really an array, view it as a array, otherwise raise Representation.

toExn ob
If ob is really an exception value, view it as a exn, otherwise raise Representation.

toReal ob
If ob is really an floating-point number, view it as a real, otherwise raise Representation.

toInt ob
If ob is really a tagged 31-bit integer, view it as an int, otherwise raise Representation.

toInt32 ob
If ob is really a 32-bit integer or byte-vector of length 4, view it as an Int32.int, otherwise raise Representation.

toWord ob
If ob is a tagged 31-bit value, view it as a word, otherwise raise Representation.

toWord8 ob
If ob is a tagged 31-bit value, view it as a Word8.word, otherwise raise Representation.

toWord32 ob
If ob is really a 32-bit value or byte-vector of length 4, view it as a Word32.word, otherwise raise Representation.



[ Top | Parent | Contents | Index | Root ]

Last Modified October 28, 1997
Comments to sml-nj@research.bell-labs.com
Copyright © 1998 Bell Labs, Lucent Technologies