Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Class specification #134

Merged
merged 32 commits into from
Feb 4, 2022
Merged

Class specification #134

merged 32 commits into from
Feb 4, 2022

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
NEWS.md Outdated Show resolved Hide resolved
R/class-spec.R Outdated Show resolved Hide resolved
R/class-spec.R Outdated Show resolved Hide resolved
R/class-spec.R Outdated Show resolved Hide resolved
R/class-spec.R Outdated Show resolved Hide resolved
R/method.R Outdated Show resolved Hide resolved
_pkgdown.yml Show resolved Hide resolved
R/class-spec.R Outdated Show resolved Hide resolved
tests/testthat/_snaps/property.md Outdated Show resolved Hide resolved
tests/testthat/test-class-spec.R Outdated Show resolved Hide resolved
@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