init-struct ( class with-prototype: ( prototype -- alien ) sans-prototype: ( class -- alien ) -- alien )


Vocabulary
classes.struct.private

Inputs
classan object
with-prototypea quotation with stack effect ( prototype -- alien )
sans-prototypea quotation with stack effect ( class -- alien )


Outputs
alienan object


Definition


: init-struct
( class with-prototype: ( prototype -- alien ) sans-prototype: ( class -- alien ) -- alien )
[ [ [ [ struct-prototype ] ] ] dip ] dip [ ?if ] 2curry
compose keep memory>struct ; inline