<<<<<<<<<<<<<<<<<

metaobject(prog_tools) Library_Name metaobject(prog_tools)

NAME

metaobject - an instance of a metaclass, primarily used by the metaclass

DESCRIPTION

metaobject is the compiled LYMB class that is used to support creating instances of metaclasses. Much like how metaclass is a runtime defined class, metaobject is an instance of a runtime defined class. Normally the script level user would never directly create a metaobject, the metaclass object creates it for you. For more information on how to create and use metaclasses see the metaclass man page.

SUPERCLASS

object

INSTANCE VARIABLES

free_actions are actions that will be executed before a metaobject is freed.

METHODS

free_actions(=,+,?) set, append to or retrieve free_actions.

EXAMPLE

/* node class -- Used to create the nodes of a directed graph. Each node has zero or more successors and zero or more predecessors. */

metaclass new: `node'

fields+ (`collection', `successors') fields+ (`collection', `predecessors')

methods+ (`predecessors+') methods+ (`successors+') methods+ (`predecessors?') methods+ (`successors?') ;

/* Methods for node class. */

node method# `predecessors+' /* arguments: new_pred */

call_actions= ` string new: new_pred = [args @1 string_args?];

self field# "predecessors" members+ ( new_pred ); object#new_pred field# "successors" members+ ( [self name?] ); ' ;

node method# `successors+' /* arguments: new_succ */ call_actions= ` string new: new_succ = [args @1 string_args?];

self field# "successors" members+ ( new_succ ); object#new_succ field# "predecessors" members+ ( [self name?] ); ' ;

node method# `successors?' call_actions= ` self method# `successors?' return_value= [self field# "successors" members?]; ' ;

node method# `predecessors?' call_actions= ` self print:name; self method# `predecessors?' return_value= [self field# "predecessors" members?]; ' ;

! Create a graph of 7 nodes

node new:"t1"; node new:"t2"; node new:"t3"; node new:"t4"; node new:"t5"; node new:"t6"; node new:"t7";

! Establish connection of nodes t1 successors+( "t2" ); -- t2----t5 t1 successors+( "t3" ); -- / \ / \ t2 successors+( "t4" ); -- t1 t4 t7 t2 successors+( "t5" ); -- \ / \ / t3 successors+( "t4" ); -- t3----t6 t4 successors+( "t5" ); -- .

t5 successors+( "t7" ); t6 successors+( "t7" ); t3 successors+( "t6" ); t4 successors+( "t6" );

! The node network now looks like this: ! ! t2----t5 ! / \ / \ ! t1 t4 t7 ! \ / \ / ! t3----t6 ! ! for example, sending t4 will list its predecessors and ! successors if you send print! to it:

t4 print!;

SEE ALSO

metaclass procedure


Please send comments and suggestions to
consult@rpi.edu