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

[REBOL] Re: Sameness - a pragmatic approach.

From: joel:neely:fedex at: 11-Feb-2003 7:30

Hi, Gabriele, Gabriele Santilli wrote:
> v: 1 > b: [1] > insert tail b v > > So we have two choices: either decide that immutable values that > are equal are to be considered the same value (so that both V and > the two values in the block are the same value), or that immutable > values are never the same (so that we have three different "1"s > above). I am inclined for the latter just because it avoids > another layer of abstraction that is not useful for any other > things except the SAME? function. >
I am inclined for the former interpretation, for (oddly enough) the same reason (avoiding unnecessry concepts). I can think of no test that distinguishes among the value of V and the two values in B, and therefore conclude that they are the same. The concept of "where a value was obtained" seems entirely too complicated to my poor brain. On the other hand, given v: "one" b: ["one"] insert tail b v it is easy to engage in behavior that distinguishes the two values in B, therefore I'd conclude that they may be equal (same content, recursively investigated if necessary) but not identical in all respects. I can do this without concern for "where" those values may be mentioned, which makes this seem simpler to me. I'd distinguish between "reading" and "writing" activity, (i.e. read-only access vs. mutation) and take the view that for any two values A and B, equal? a b would be defined as (using non-REBOL but common concepts) for all R in "reading" (R a) = (R b) (yeah, I know that's recursive, there are just too many "primitive" data types in REBOL for me to write all of the base cases ;-) OTOH, same? a b would be defined as all [ for all R in "reading" (R a) = (R b) for all W in "writing" and R in "reading" (W a R a) = (R b) ] So, for example, letting R be MOLD and W be REMOVE , we have v: "one" b: ["one"] insert tail b v (remove b/1 probe mold b/1) = (probe mold b/2) to distinguish the two values in B proving that they are not SAME? Under that view, there are no "writing" activities for immutable values, therefore the second clause in SAME? is vacuously true. And, of course, EQUAL? and SAME? must obey the standard Mathematical requirements for equivalence relations (must be reflexive, symmetric, and transitive). -jn-