fieldWithPrototype {objectSignals}R Documentation

Fields with prototypes

Description

A convenience for declaring a default value for a field, in the vein of prototype for S4 classes, except the default value is quoted and evaluated lazily.

Usage

fieldWithPrototype(name, class, value)

Arguments

name

The name of the field

class

The class of the field

value

Default value that when evaluated initializes the field

Value

A list suitable for use with setRefClass

Author(s)

Michael lawrence

Examples

Brush.gen <- setRefClass("Brush",
fields = fieldWithPrototype("color", "character", "red"))
brush <- Brush.gen$new()
brush$color
brush$color <- "blue"
brush$color

[Package objectSignals version 0.10.3 Index]