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

[REBOL] Re: On mutability and sameness

From: joel:neely:fedex at: 16-Jun-2001 23:30

Hi, again, Ken, Using the ideas in my reply to your previous post (I just sent it a couple of minutes ago)... Ken Anthony wrote:
> ...and how about this? > > a: [1:30] > b: [1:30] > same? a b ;==false >
...this outcome is easy to predict. Notice that A and B are both blocks, with EQUAL? content, but since they were constructed separately, they are not the SAME? block.
> same? do a do b ;==true >
Remember that when DO is given a block, it evaluates all expressions in the block, and returns the value of the last expression as its result. Given that fact:
>> do a == 1:30 >> do b == 1:30 >> same? do a do b == true
The result value from DO A is the TIME! value of 1:30, and likewise for DO B . Since TIME! is not a reference type, any occurrence of 1:30 is the same as any other occurrence of 1:30. Therefore, any expression that produces a TIME! value of 1:30 yields a result that is SAME? to the result of any other expression yielding 1:30, even something like:
>> 0:30 * 3 == 1:30 >> same? do a 0:30 * 3 == true >> same? 2:00 - 0:30 0:30 * 3 == true
-jn- ------------------------------------------------------------ Programming languages: compact, powerful, simple ... Pick any two! joel'dot'neely'at'fedex'dot'com