#include <muse.h>
Data Fields | |
| int | magic_word |
| Should always be 'muSE'. | |
| int | type_word |
| Should be some type specific four character word. | |
| int | size |
| The size of the object in bytes - total. | |
| muse_nativefn_t | fn |
| The function that will be invoked when the object is used in the function position. | |
| void *(* | view )(int id) |
| A "view" is some arbitrary piece of information descriptive of this object's type, what the object can do, or what you can do with it. | |
| void(* | init )(void *obj, muse_cell args) |
| An initializer function that's called after object creation to initialize its contents according to the given arguments. | |
| void(* | mark )(void *obj) |
| A type specific marker function that is expected to mark all objects referenced by this functional object using muse_mark function. | |
| void(* | destroy )(void *obj) |
| The functional obnject will be kept on the specials stack. | |
| void(* | write )(void *obj, void *port) |
| The object should be written out in a textual format such that read (with macros and braces enabled) will be able to automatically create the object when it encounters the expression. | |
Should always be 'muSE'.
Should be some type specific four character word.
The size of the object in bytes - total.
The function that will be invoked when the object is used in the function position.
| void*(* muse_functional_object_type_t::view)(int id) |
A "view" is some arbitrary piece of information descriptive of this object's type, what the object can do, or what you can do with it.
A particular object type can choose to provide any "view" it sees as appropriate. Currently the only view is as a 'mnad' or a "Monad view" that allows the standard map, join, filter and reduce operations on it. Its technically not a monad, but I couldn't find any other data structure term that can summarize the fact that these functions can be used on lists, vectors, hashtables.
| void(* muse_functional_object_type_t::init)(void *obj, muse_cell args) |
An initializer function that's called after object creation to initialize its contents according to the given arguments.
| void(* muse_functional_object_type_t::mark)(void *obj) |
A type specific marker function that is expected to mark all objects referenced by this functional object using muse_mark function.
| obj | A pointer to this object, starting at the base muse_functional_object_t address. |
| void(* muse_functional_object_type_t::destroy)(void *obj) |
The functional obnject will be kept on the specials stack.
When no references to the object are detected, the destroy function of the object will be called and it will be removed from the environment.
| void(* muse_functional_object_type_t::write)(void *obj, void *port) |
The object should be written out in a textual format such that read (with macros and braces enabled) will be able to automatically create the object when it encounters the expression.
If this function is NULL, the standard "<prim:blah>" kind of unreadable stuff will be written out.
1.4.7