extend: Extend a Type upon a (Proto)type

Description Usage Arguments Value Examples

View source: R/core.R

Description

Used only inside a type definition

Usage

1

Arguments

prototype

Q7type; function

Value

localized Q7type; function

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
Type1 <- type(function(arg1){
    val1 <- arg1
    get_val1 <- function(){
         val1
    }
}, "Type1")

Type2 <- type(function(arg1, arg2){
    extend(Type1)(arg1)
    val2 <- arg2
    get_val2 <- function(){
        val2
    }
}, "Type2")

myType2 <- Type2("foo", "bar")

myType2$get_val1()
myType2$get_val2()

Q7 documentation built on Jan. 13, 2021, 10:11 a.m.