fieldWithPrototype: Fields with prototypes

View source: R/utils.R

fieldWithPrototypeR 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

ggobi/objectSignals documentation built on April 8, 2022, 7:15 a.m.