Artifact 43c65eb03cd340aad317593df4ceb8813e2ce69e
File user/docl/objects/docl_2010-05-30 part of check-in [62c2caabee] - esperanto, user dir by luke on 2010-06-01 02:25:49. [annotate] Also file objects/docl_2010-05-30 part of check-in [57aec90ce5] - Add some of the various experiments in creating objects with properties and methods by charleschilders on 2010-05-31 22:34:31. [annotate]
variable this : .object ( a- ) .data !this ; : object ( "- ) variable &.object reclass ; : switch ( - ) @@this @last !@this !last ; : stat ( n- ) switch variable: switch ; : keep ( $- ) here over getLength dup 1+ allot copy ; : desc ( "- ) char: ; accept here tib keep stat ; : attr ( - ) -1 stat ; : word ( "- ) switch : switch ; : prop switch ' @ .data switch ; immediate : prop: switch ' .data switch ; immediate : act switch ' switch .word ; : props switch words switch ; : handle-attrs dup @@d->xt -1 =if dup d->name type space then ; : attrs this repeat @ 0; handle-attrs again ; object orc orc attr smelly orc attr dirty orc 54 stat str orc 10 stat wis orc 0 stat dead orc desc This is an orc.; full orc word look prop full type cr attrs ; orc word kill prop: dead on ." You have killed the Orc." ; ork word unkill prop: dead off ." The orc is no longer dead. What a miracle!" ; orc act look orc act kill orc act look