[objects] object's third "attribute" woes
[1/2] from: maximo::meteorstudios::com at: 14-Jan-2004 12:21
now I have another associated issue with this whole mold/load/save thing.
the 'third "attribute" of an object incorrectly changes some datatypes.
the most notable is the lit-word! type which becomes an unset word! instead!!!!!
this is bad. You cannot re-create the base object from it then, or even use words.
although creating a litle word 'fixer is easy, does anyone know if there is a standard
way to do so.
my solution so far is:
;----------8<---------------------------------------------
; --- example object ---
;-----------------------
object: make object! blk: [
a: 'some-word
]
blk: third object
probe blk
; --- example fix ---
;--------------------
forall blk [
item: first blk
if word! = type? item [
if not (value? item) [
change blk to-lit-word item
]
]
]
probe blk
;---------8<----------------------------------------------
HTH!!
-MAx
---
You can either be part of the problem or part of the solution, but in the end, being
part of the problem is much more fun.
[2/2] from: greggirwin:mindspring at: 14-Jan-2004 11:46
Hi Max,
MOA> the 'third "attribute" of an object incorrectly changes some
MOA> datatypes.
See Gabriele's note, a few messages back, about using CONSTRUCT.
-- Gregg