Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: disappearing data?

From: jeff:rebol at: 10-Nov-2000 17:36

Howdy, Ryan:
> Why is the translate-message/markup-data function "reusable" in the > following code.... > > translate-message: make object! [ > > markup-data: func [ > data [object!] > ][ > xml-tags: [ > ["author" "/author"] > ["subject" "/subject"] > ["date" "/date"] > ["content" "/content"] > ["messageID" "/messageID"] > ]
Because the by having your static xml-tags block in the function it has the effect of doing: xml-tags: head xml-tags for each function call. Otherwise the function leaves the object's xml-tags pegged at the tail: . . .
> for x 1 (length? xml-tags) 1 [
. . .
> xml-tags: next xml-tags
Here's the basic effect: o1: make object! [ f: does [ b: [1 2 3] print mold b forall b [] ] ] o2: make object! [ b: [1 2 3] f: does [ print mold b forall b [] ] ]
>> o1/f
[1 2 3]
>> o1/f
[1 2 3]
>> o2/f
[1 2 3]
>> o2/f
[] ;- jeff