Skip to content

quote() in new_property is raising an error rather than deferring execution #567

@genovese

Description

@genovese

I have a property whose default should be a new object. My understanding was that using quote in new_property created such a promise, e.g., "A quoted call becomes a standard function promise in the default constructor, evaluated at the time the object is constructed" in the documentation.

With version 0.2.0.9000 (and also 0.1.1) and R version 4.4.1 on a Mac, I get the following instead

Dict <- class_environment
Foo <- new_class("Foo", properties=list(foo=new_property(Dict, default=quote(new_environment()))))

which produces the error

Error in new_property(Dict, default = quote(new_environment())) : 
  `default` must be an instance of <environment>, not a <language>

Have I misunderstood this use or how to carry it out?

Thanks for your help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions