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

> BUT not in the following code...
> 
> 
> translate-message: make object! [
> 
>      xml-tags: [
>      ["author" "/author"]
>      ["subject"  "/subject"]   ["date"  "/date"]  ["content"
>      "/content"] ["messageID" "/messageID"] ]

-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to