REBOL3 tracker
  0.9.12 beta
Ticket #0001165 User: anonymous

Project:



rss
TypeBug Statustested Date31-Jul-2009 18:52
Versionalpha 76 CategoryNative Submitted byBrianH
PlatformAll Severitytweak Prioritynormal

Summary MAKE object broken with aliased proto fields
Description I'm not sure how important this bug is, but the behavior of MAKE proto-object is off when the proto has aliased fields. The resulting object has the last of the aliased fields assigned rather than the first, which means that any references return the original first slot value, not the changed value.

It doesn't matter whichever order the words were specified in the call to ALIAS - the first aliased slot of an object is always referenced, and the last aliased slot of the proto is always propagated. If the latter aliased slots are copied to the new object at all, the first slot is the one that should be modified by any spec code, not the last.
Example code
>> o: context [a: 1 b: 2 c: 3]
== make object! [
    a: 1
    b: 2
    c: 3
]
>> alias 'a "b"
== b
>> alias 'a "c"
== c
>> o2: make o [a: 99]
== make object! [
    a: 1  ; should be 99
    b: 2  ; should be 99, or 2, or not here at all
    c: 99  ; should be 99, or 3, or not here at all
]
>> o2/a
== 1
>> o2/b
== 1
>> o2/c
== 1

Assigned ton/a Fixed inalpha 111 Last Update26-Feb-2011 01:12


Comments
(0001457)
Carl
3-Aug-2009 19:34

This is an interesting bug. I'm going to mark it reviewed for closer study.

Essentially, if this bug is true, then the same type of error can be achieved via capitalization differences, since they are also aliases. That would be quite serious. Bumped severity to major.
(0001462)
BrianH
4-Aug-2009 19:54

This bug only affects words that are aliased after they are loaded into an object. Words that differ only in capitalization are aliased at word creation time, before they are used. So attempts to add them to an object will operate on the original slot.

In regular code this will usually affect usage of ALIAS word! word! (see #341, #1163, #1164).
(0001559)
BrianH
21-Aug-2009 20:29

As of alpha 79 and the fixing of #341, this will only affect ALIAS in code that would break in R2: Words that differ in spelling, not in capitalization, and have already been used somewhere.
(0003071)
BrianH
31-Jan-2011 06:19

The ALIAS function has been removed in alpha 111. See #1835 for details.

Date User Field Action Change
26-Feb-2011 01:12 BrianH Status Modified built => tested
31-Jan-2011 06:19 BrianH Comment : 0003071 Added -
31-Jan-2011 06:18 BrianH Fixedin Modified => alpha 111
31-Jan-2011 06:18 BrianH Status Modified reviewed => built
22-Sep-2010 05:54 carl Severity Modified major => tweak
21-Aug-2009 20:29 BrianH Comment : 0001559 Added -
4-Aug-2009 19:56 BrianH Comment : 0001462 Modified -
4-Aug-2009 19:54 BrianH Comment : 0001462 Added -
3-Aug-2009 19:36 carl Comment : 0001457 Modified -
3-Aug-2009 19:35 carl Comment : 0001457 Modified -
3-Aug-2009 19:35 carl Description Modified -
3-Aug-2009 19:35 carl Code Modified -
3-Aug-2009 19:35 carl Severity Modified minor => major
3-Aug-2009 19:35 carl Status Modified submitted => reviewed
3-Aug-2009 19:34 carl Comment : 0001457 Added -
31-Jul-2009 18:52 BrianH Ticket Added -