REBOL3 tracker
  0.9.12 beta
Ticket #0001863 User: anonymous

Project:



rss
TypeBug Statusbuilt Date3-Mar-2011 20:58
Versionalpha 111 CategoryNative Submitted byBrianH
PlatformAll Severitymajor Prioritynormal

Summary MAKE object object doesn't rebind functions
Description When making an object from an object prototype and object spec, functions in the result are not rebound, they are the same as the original. In contrast, when using an object prototype and a block spec, the functions are rebound. Rebinding seems like the more expected behavior.

Note: In R2, they are rebound in both cases.

Originally noticed by Bolek, reported in AltME.
Example code
; The prototype context
>> a: context [f: does [print b] b: none]
== make object! [
    f: make function! [[][print b]]
    b: none
]

; Making an object based on the proto and an object spec
>> c: context  [b: 1]
== make object! [
    b: 1
]
>> a1: make a c
== make object! [
    f: make function! [[][print b]]
    b: 1
]
>> a1/f
none  ; expected 1
>> same? :a/f :a1/f
== true  ; expected false

; For comparison, making an object based on the proto and a block spec
>> a2: make a [b: 1]
== make object! [
    f: make function! [[][print b]]
    b: 1
]
>> a2/f
1
>> same? :a/f :a2/f
== false

Assigned ton/a Fixed inr3 master Last Update19-Feb-2014 21:33


Comments
(0003139)
BrianH
3-Mar-2011 21:12

You can work around this by converting the object spec to a block with TO-BLOCK or BODY-OF. Is it a benefit to have the different behaviors available? It's certainly confusing to people who don't expect it.
(0003926)
Ladislav
15-Aug-2013 11:22

This is a "multiple inheritance" case. Thus, it is a complicated matter and no wonder it is not done right when even the single inheritance is having issues.

At the time of this writing it is not true that when make object block is evaluated the functions are truly rebound as #2045 (which is the single inheritance issue) demonstrates.
(0003929)
Ladislav
15-Aug-2013 15:09

In the core-tests suite.
(0003952)
Ladislav
28-Aug-2013 14:33

Fixed by https://github.com/rebol/rebol/pull/139

Date User Field Action Change
22-Feb-2014 18:20 Ladislav Comment : 0003926 Modified -
19-Feb-2014 21:33 BrianH Fixedin Modified => r3 master
19-Feb-2014 21:33 BrianH Status Modified pending => built
30-Aug-2013 01:52 Ladislav Severity Modified minor => major
28-Aug-2013 14:33 Ladislav Status Modified reviewed => pending
28-Aug-2013 14:33 Ladislav Comment : 0003952 Added -
15-Aug-2013 15:09 Ladislav Comment : 0003929 Added -
15-Aug-2013 11:42 Ladislav Comment : 0003926 Modified -
15-Aug-2013 11:31 Ladislav Comment : 0003926 Modified -
15-Aug-2013 11:26 Ladislav Comment : 0003926 Modified -
15-Aug-2013 11:22 Ladislav Comment : 0003926 Added -
20-Mar-2011 03:03 carl Status Modified submitted => reviewed
4-Mar-2011 00:53 BrianH Description Modified -
4-Mar-2011 00:53 BrianH Code Modified -
3-Mar-2011 21:12 BrianH Comment : 0003139 Added -
3-Mar-2011 20:58 BrianH Ticket Added -