Hello, Message passing in Factor:
http://dharmatech.onigirihouse.com/message-passing/message-passing.factor Examples of classes that use this: http://dharmatech.onigirihouse.com/message-passing/examples/foo.factor http://dharmatech.onigirihouse.com/message-passing/examples/bar.factor The print method: scratchpad 10 <foo> ---------- T{ foo f 10 } ---------- scratchpad "print" send-message printing foo : T{ foo f 10 } ---------- ---------- scratchpad scratchpad 10 20 30 <bar> ---------- T{ bar f 10 20 30 } ---------- scratchpad "print" send-message printing bar : T{ bar f 10 20 30 } ---------- ---------- scratchpad The frob method on foo: scratchpad 10 <foo> ---------- T{ foo f 10 } ---------- scratchpad 4 ---------- T{ foo f 10 } 4 ---------- scratchpad over ---------- T{ foo f 10 } 4 T{ foo f 10 } ---------- scratchpad "frob" send-message ---------- T{ foo f 16 } ---------- scratchpad The frob method on bar: scratchpad 10 20 30 <bar> ---------- T{ bar f 10 20 30 } ---------- scratchpad dup >r 1 2 3 r> ---------- T{ bar f 10 20 30 } 1 2 3 T{ bar f 10 20 30 } ---------- scratchpad "frob" send-message ---------- T{ bar f 10 6 30 } ---------- scratchpad While print is easily done as a generic word, frob is not. Why? Because the stack effect of frob on foo is not the same as the stack effect of frob on bar. A parsing word can help with the verbose message send syntax. Ed ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Factor-talk mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/factor-talk
