REBOL3 tracker
  0.9.12 beta
Ticket #0002045 User: anonymous

Project:



rss
TypeBug Statusbuilt Date8-Aug-2013 14:55
Versionr3 master CategoryDatatype Submitted byLadislav
PlatformAll Severitymajor Prioritynormal

Summary Cloning objects and rebinding
Description In my opinion, when a parent object is cloned, function bodies and other blocks copied to the child object should be rebound to the child object, i.e., words should be bound to the child object if and only if they were bound to the parent object. Rebinding behaviour is observable in R2, but R3 exhibits unexpected behaviour.
Example code
; an example examining function body rebinding

a: 1
f: func [] [a]
g: :f
o1: make object! [a: 2 g: :f]
o2: make o1 [a: 3 g: :f]
o3: make o1 [a: 4]
g ; == 1 expected, works this way both in R2 and in R3
o1/g ; == 1 expected, works this way both in R2 and in R3
o2/g ; == 1 expected, works this way both in R2 and in R3
o3/g ; == 4 in R3, which is unexpected, in R2 the expression yields 1

; a similar example, this time examining block rebinding

a: 1
b: [a]
c: b
o1: make object! [a: 2 c: b]
o2: make o1 [a: 3 c: b]
o3: make o1 [a: 4]
do c ; == 1 (both in R2 and in R3)
do o1/c ; == 1 (both in R2 and in R3)
do o2/c ; == 1 (both in R2 and in R3)
do o3/c ; == 4 (in R3, which is not what I expected) and == 1 in R2

Assigned ton/a Fixed in- Last Update11-Mar-2014 19:16


Comments
(0003915)
Ladislav
9-Aug-2013 14:56

In the core-tests suite.
(0003924)
BrianH
15-Aug-2013 04:50

See also #1863, which is either related or the same thing.
(0003925)
Ladislav
15-Aug-2013 11:13

#1863 is a multiple inheritance case, while this is a single inheritance case.
(0003947)
Ladislav
21-Aug-2013 01:19

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

Date User Field Action Change
11-Mar-2014 19:16 Ladislav Status Modified pending => built
30-Aug-2013 01:47 Ladislav Code Modified -
30-Aug-2013 01:46 Ladislav Code Modified -
30-Aug-2013 01:46 Ladislav Description Modified -
21-Aug-2013 01:19 Ladislav Status Modified submitted => pending
21-Aug-2013 01:19 Ladislav Comment : 0003947 Added -
15-Aug-2013 11:43 Ladislav Comment : 0003925 Modified -
15-Aug-2013 11:15 Ladislav Comment : 0003925 Modified -
15-Aug-2013 11:14 Ladislav Comment : 0003925 Modified -
15-Aug-2013 11:14 Ladislav Comment : 0003925 Modified -
15-Aug-2013 11:13 Ladislav Comment : 0003925 Added -
15-Aug-2013 04:50 BrianH Comment : 0003924 Added -
9-Aug-2013 14:56 Ladislav Comment : 0003915 Added -
8-Aug-2013 15:50 Ladislav Code Modified -
8-Aug-2013 15:49 Ladislav Description Modified -
8-Aug-2013 15:17 Ladislav Description Modified -
8-Aug-2013 15:16 Ladislav Code Modified -
8-Aug-2013 15:16 Ladislav Code Modified -
8-Aug-2013 15:02 Ladislav Description Modified -
8-Aug-2013 15:02 Ladislav Summary Modified Cloning functions in objects => Cloning objects and rebinding
8-Aug-2013 14:56 Ladislav Severity Modified minor => major
8-Aug-2013 14:56 Ladislav Code Modified -
8-Aug-2013 14:55 Ladislav Ticket Added -