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

[REBOL] Re: On mutability and sameness

From: kenneth:nwinet at: 16-Jun-2001 22:34

Reading my mind again Joel,
> > 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
I just finished doing a bunch of tests like this (I honored to be in such esteem company! ;-)) ken.