Skip to content

Can't change property default in subclass #570

Closed

Description

@hadley

I think it would be useful if you could do this:

library(S7)

foo <- new_class("foo", properties = list(x = new_property(class_numeric, default = 1)))
foo2 <- new_class("foo2", foo, properties = list(x = new_property(class_numeric, default = 2)))
foo2()@x
#> [1] 1

Created on 2025-09-25 with reprex v2.1.1

Activity

  1. fithisux commented on Oct 7, 2025

    @fithisux

    I tested it in my Windows 10 x64 with R 4.5.1 and gives exactly that.

    Maybe you mean 2?

    Because as a newcomer to S7, the above seems completely counterintuitive

  2. hadley commented on Oct 7, 2025

    @hadley
    MemberAuthor

    This is a bug report; 1 is the incorrect answer.

  3. ltuijnder commented on Oct 28, 2025

    @ltuijnder

    This is a duplicate of: #467

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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