-
Notifications
You must be signed in to change notification settings - Fork 229
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
Simplify #265
Simplify #265
Conversation
* yielding the object from within #initialize and having .new return the value is essentially what Configuration.build was doing.
Thanks, this looks good but before I merge it in (I want to) I need to verify why the hell it was implemented like that in the first place. That Configuration is some weird stuff. It doesn't look like written by me - why would I make the configuration object mutable, why would I use attr accessors to set its state in the build method. Really really weird. I almost wonder if there wasn't any specific reason for handling it like that. @elskwid do you maybe remember why it's done like that? I'm completely stumped :) |
@solnic git blame? lol ;-) |
I know I wrote it I just don't remember why. It's even bigger lol :) I actually now see that config is supposed to be mutable. So this behavior has to stay. On Thu, Apr 17, 2014 at 10:03 AM, Bernard Lambeau
|
Aren't tests supposed to tell you why nowadays? I mean BDD and all that jazz. It's tempting to conclude, therefore, that if tests pass after making config immutable (say), there is no such why and you can move forward. Isn't? |
Yes exactly I looked at tests and got my answer. Sorry for the noise ;) On Thu, Apr 17, 2014 at 10:16 AM, Bernard Lambeau
|
@solnic yeah I got the impression that the global configuration could be modified via |
OK now I remember the story. Goes back to DM1 where configuration was global and associated with type classes. With 1.0 I started the process of moving away from this completely with configuration instances being used by virtus' modules and that's one of the reasons why we have anonymous modules. I suspect it would be already possible to make the config immutable for the generated modules. |
Speaking of which, why is there |
It seems redundant and I don't think there's any concrete reason for its existence /cc @elskwid |
@postmodern, @solnic - At the time we didn't have the configurable inclusions, which I know is under discussion, so the Do we need or use it now? If not, I say we get rid of it. |
Yeah global config will be deprecated in 1.1 and removed in 2.0. On Thu, Apr 17, 2014 at 4:29 PM, Don Morrison notifications@github.com
|
Made minor simplifications to the internal API for Configuration.
yield
instead ofConfiguration#call
.#call
should only be defined for objects that represent code, imho.Configuration.build
in favor of allowingConfiguration#initialize
to initialize it's instance variables and yielding itself. Yielding from within#initialize
and having.new
return the new instance is the same behavior as.build
.