Skip to content

Class specification#134

Merged
hadley merged 32 commits intomasterfrom
class-lookup
Feb 4, 2022
Merged

Class specification#134
hadley merged 32 commits intomasterfrom
class-lookup

Conversation

@hadley
Copy link
Member

@hadley hadley commented Jan 17, 2022

This is a rather large set of changes but should have relatively little impact on the actual interface. The main goal is to bring consistency to the way that classes are specified as parents, in properties, in unions, and in method registration/dispatch.

The main change to functionality is that specifying a class with a string (e.g. method(foo, "classname")), can now only refer to a base type. It could previously mean one of three things: the name of an R7 class defined in the calling environment, a S3 class, or a base type. This ambiguity seemed dangerous to me, so I reduced it by eliminating the lookup in the calling environment and introduced a new s3_class() helper for registering S3 classes.

Fixes #120

hadley added a commit that referenced this pull request Jan 17, 2022
Changes to base types:
* make numeric a union
* add new atomic and vector unions
* remove factor and data.frame S3 classes
* add expression base type

And includes a few quality of life improvements:

* Method dispatch failure now reports correct classes
* Methods created from union now have own names
* More explicit error when parent is a union

Fixes #77. Fixes #94. Built on top of #134.
hadley added a commit that referenced this pull request Jan 27, 2022
* Adds numeric, atomic, and vector unions
* Adds expression base type

Fixes #77. Fixes #94. Built on #134.
@hadley hadley mentioned this pull request Jan 27, 2022
Conflicts:
	tests/testthat/_snaps/class.md
Conflicts:
	R/object.R
	tests/testthat/_snaps/object.md
@hadley hadley merged commit 6b2cab9 into master Feb 4, 2022
@hadley hadley deleted the class-lookup branch February 4, 2022 23:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Common class specification

2 participants