bind is the postscript call to create an optimized, read-only procedure body.
We can add an additional optimization to the usual replacement of names with operator objects, and that is: input/output type analysis and removal of internal typechecks. As a simple example, the mod operator, if its inputs are correct, produces an integertype object, so if a procedure begins with the sequence mod copy ... say, then we know that this is the integer-case of copy and don't need to do dynamic typechecking and polymorphic dispatch at runtime to select the correct integer-case function; we can factor this out to a different representation at bind time.
One complication is that the procedure body remains accessible as a regular postscript array, so any operator objects extracted, using get perhaps, must decay back to their fully-typechecked, polymorphic version.
bind
is the postscript call to create an optimized, read-only procedure body.We can add an additional optimization to the usual replacement of names with operator objects, and that is: input/output type analysis and removal of internal typechecks. As a simple example, the
mod
operator, if its inputs are correct, produces anintegertype
object, so if a procedure begins with the sequencemod copy ...
say, then we know that this is theinteger
-case of copy and don't need to do dynamic typechecking and polymorphic dispatch at runtime to select the correctinteger
-case function; we can factor this out to a different representation atbind
time.One complication is that the procedure body remains accessible as a regular postscript array, so any operator objects extracted, using
get
perhaps, must decay back to their fully-typechecked, polymorphic version.