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

[REBOL] Re: On mutability and sameness

From: lmecir:mbox:vol:cz at: 6-Jun-2001 7:47

Hi Colin,
> No worries. I think the only point I was making was that Joel *may* be > mistaking a bug for an esoteric, and hard-to-model, feature. > > I don't even have much of a problem knowing Rebol has bugs in it (or > "confusing quirk" to use the term Feedback used to describe why
> copy []
won't clear a VID text-list---you have to write "clear face/data").
> All software has bugs, and given the speed the Rebol guys are moving, it's > astounding there are so few....They write quality code with a vengeance! > > But I would appreciate (and I know I'm not the first to ask) a bug > list.....I've spent an embarrassing amount of time "debugging" (or
> over) things like Poking a Tuple or clearing a Text-list or DOing a
string. A
> simple, searchable database of reported problems and known workarounds
> help us all. > > --Colin.
I am pretty sure, that the feature you are describing is not a bug. The reason for the behaviour is pretty simple. Rebol values of type TUPLE! DATE! INTEGER! and some other types are immutable - Mark Dickson uses the word constant to express the same feature. What does the strange word mean? No Rebol function can change these values. Example: try-to-change1: func [ value [tuple!] ] [ either value = 1.1.1 [value: 1.1.2] [value: 1.1.1] value ] a: 1.1.2 ; == 1.1.2 try-to-change1 a ; == 1.1.1 a ; == 1.1.2 As you can see, the function I wrote wasn't able to change the supplied value, instead it computed a new different value. How about another function: try-to-change2: func [ 'value [word!] ] [ either (get value) = 1.1.1 [set value 1.1.2] [set value 1.1.1] get value ] a: 1.1.2 ; == 1.1.2 try-to-change2 a ; == 1.1.1 a ; == 1.1.1 Here it looks like I succeeded to change the supplied value 1.1.2. In fact I didn't change the value 1.1.2. I computed a new value 1.1.1 instead and stored it to the supplied word 'a , which now contains a different value than before. the same effect I can achieve using a set-path: a: 1.1.2 ; == 1.1.2 a/3: 1 ; == 1 a ; == 1.1.1 Regards Ladislav