-
Notifications
You must be signed in to change notification settings - Fork 37
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
Proposal: Prevent set_package after a package has already been set #106
Comments
@jameslamb @bburns632 especially would like your input here. To briefly summarize some discussion I had with @jameslamb last night: he asked why not just put the package in the constructor. We didn't want to do that because we want to instantiate |
I think probably a simpler solution is to just make the package setting part of the the constructor. We can easily define
and then this part of
Of course, this is a breaking change. If we decide to do this, we should do it sooner rather than later. |
@jayqi with the significant changes you made this past month or two, do you see this change as more, less, or equally valuable as when it was proposed? |
@bburns632 I just talked through this with @jayqi . I argued that we should NOT change If we were to do the "pass in class generators" thing, you would have to expose I propose that we keep the pattern we have (this is a well-known design pattern called dependency injection) but that we reduce the complexity of the code by revoking the ability to reset the package on a Reporter once it's been set. |
Right now, we have a lot of calculated stuff cached in the Reporters, e.g., nodes, edges, metrics. If a user overwrites the package by calling
set_package
again, then it invalidates those cached objects and so we have functionality toreset_cache
and wipe them out.This has a downside in that having to worry about cache resetting adds complexity. As an example, it has led to bug #70.
I propose that instead, we prevent users from overwriting the package set for a Reporter (i.e., if
private$private_pkg_name
exists, throw a fatal error if they try to useset_package
).The text was updated successfully, but these errors were encountered: