[REBOL] Re: initializing system/standard/email
From: tim-johnsons:web at: 3-Sep-2006 8:07
* jose <jjmmes-yahoo.es> [060903 05:37]:
> Hi Gabriele,
> I still don't see the bug and I've studied this code
> > > TJ> if not show [insert clear header-obj/to addr]
> > > TJ> ;; 'addr is being 'clear'ed
> What is cleared is header-obj/to BUT not addr
1)'send needs the 'address and 'message arguments
2)with the /header refinement, a header-obj of type
object! is also required
The problem occurs when the /header refinement is used
and the 'to member of the header object is *also* used
as the 'address argument, because the following
[insert clear header-obj/to addr] "destroys" the address
^ ;; same reference as 'address
Thus the fix is to create a new reference to the address
by using 'copy.
To better understand the issue here's a console session to
>> t: "jose"
>> n: copy "jose"
n: copy "jose"
>> n = t
n = t
>> same? n t
same? n t
>> o: context [t1: "jose"]
o: context [t1: "jose"]
>> t2: o/t1
>> same? t2 o/t1
same? t2 o/t1
>> clear t2
>> probe o
make object! [
I hope this helps and by now you can see the 'copy
creates a new reference and when 'address and header-obj/to
are the same reference, changing one, changes the other.
tim ((whois an ol' "c-dog")
Tim Johnson <tim-johnsons-web.com>