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

Implemented S7 by swapping the rate class and subclasses from S3 #1154

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

VisruthSK
Copy link

Fixes #1129

Notes/caveats:

I changed some tests to account for the new syntax of S7 objects--eg. changing $ to @. Additionally, the new constructor for rate objects is called just rate() instead of new_rate() so I also changed some variable names in the tests to not conflict with that.

I don't like line 71 in rate.R. There, I have a subclass with a different default value of a property than the parent class. I want to override the super's default value for max_times, but when I just include max_times as a property of the subclass with a different default, the constructed object's value goes to that of the parent. (3 instead of Infinity for rate_delay).

I got around it by checking if max_times was supplied as an argument and providing the correct default value if it wasn't.

I didn't write change any documentation, so if that needs to be changed I will fix that. The changes are mainly internal, but it may be good to document what certain things are doing so that if S7 changes the purpose of the code can still be understood.

Mentioning @kbodwin since this PR is part of the awesome Independent Study: Advanced R with Dr Bodwin this quarter!

Need to update tests, documentation. Note that order of arguments are different for subclasses in the current structure--change that.
1. Very ugly way to override super's max_times in rate_delay

2. Changed test cases a bit to correspond with new S7 syntax, but getting random errors so need to look into more
Couple caveats/notes:

Needed to change a few tests to match new S7 syntax.

Current method of overriding super's default values is inelegant (see `rate_delay`), but functional. Would like to change.

Still needs some documentation.
Changed class construction to conform with new API. Removed default values in properties as they are listed in constructors.
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.

Try using S7 instead of S3
1 participant