Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upProposal: 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_packageagain, then it invalidates those cached objects and so we have functionality toreset_cacheand 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_nameexists, throw a fatal error if they try to useset_package).