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

[REBOL] Block Creation Re:

From: joel:neely:fedex at: 18-Oct-2000 7:41

Hi, Carl, [carl--cybercraft--co--nz] wrote:
> Here's a block query... > > >> block1: [] == [] > > >> block2: to-block "" == [] > > The above would appear to have created identical blocks, but ... > ... they're not the same... >
They're EQUAL? but not SAME? (they are two distinct containers with the same content...)
> block1: text1 text1 text1 text1 text1 > block2: text2 > > I'm assuming this is normal REBOL behaviour and not a bug, (and I > know... > > block1: [] clear block1 > > would've given the same results as with to-block), but what's the > point of the difference? >
Which difference? The difference between BLOCK1 and BLOCK2, or the fact that there are two different ways to create an empty block? If the former, they are different because you can create as many distinct containers as you wish, in anticipation of later putting different (or the same ;-) stuff into each. If the latter, because REBOL has a rich variety of types and values, and there are many expressions that evaluate to the same final result. The same kind of thing can be done with other types than BLOCK! of course...
>> block1: [] == [] >> block2: to-block "" == [] >> block3: [] clear block3 == [] >> same? block1 block2 == false >> same? block2 block3 == false >> same? block1 block3 == false >> equal? block1 block3 == true >> block1 = block2 == true >> block2 = block3 == true >> block1 = block3 == true >> string1: "abc" == "abc" >> string2: to-string [#"a" #"b" #"c"] == "abc" >> string3: "" append string3 join "a" ["b" "c"] == "abc" >> same? string1 string2 == false >> same? string2 string3 == false >> same? string1 string3 == false >> equal? string1 string3 == true >> string1 = string2 == true >> string2 = string3 == true >> string1 = string3 == true
And if I've missed the point of your question entirely, I apologize; please let me know if I'm off in left field. -jn-