iqis / Q7

Freestyle Object Oriented Programming in R
GNU General Public License v3.0
5 stars 1 forks source link

When using `extend()`, base type bindings overwrites that of extended type #16

Open iqis opened 3 years ago

iqis commented 3 years ago
require(Q7)

BaseType <- type(function(a){
  b <- 1
  f <- function(){
    a + b
  }
})

bt <- BaseType(2)
bt$f()

ExtendedType <- type(function(b){
  extend(BaseType)(b)
  g <- function(){
    b
  }
})

et <- ExtendedType(3)
et$b #1
et$f() #2
et$g() #1

Users may have assumed of the opposite.