define-union-struct-class ( class slots -- ) (original) (raw)

define-union-struct-class ( class slots -- )

Vocabulary
classes.struct

Inputs

class a class
slots a sequence of struct-slot-specs

Outputs
None

Word description
Defines a new struct class where all of the slots share the same storage. This is the runtime equivalent of the UNION-STRUCT: syntax.

Definition

USING: classes.struct.private slots ;

IN: classes.struct

: define-union-struct-class ( class slots -- )
make-slots
[ compute-union-offsets ] [ struct-alignment ]
(define-struct-class) ;