These are chat archives for dry-rb/chat

12th
Nov 2016
Lucas Hosseini
@beauby
Nov 12 2016 13:13
Hey @solnic, regarding http://solnic.eu/2013/12/17/the-world-needs-another-post-about-dependency-injection-in-ruby.html – could you elaborate on why you think passing option hashes to constructors is a bad thing? Especially for DI, I would have thought that def initialize(foo: Foo.new, bar: Bar.new); …; end would be quite desirable.
a bit chaotic comment from me, but explains it (I hope)
Lucas Hosseini
@beauby
Nov 12 2016 13:20
Yeah sorry I just saw that :)
Piotr Solnica
@solnic
Nov 12 2016 13:20
fwiw we use kwargs for DI in dry-auto_inject but you define deps using injector API - a list of dependency identifiers
geez, this post is 3yo already
time flies
it was funny to see that over time my post is number 1 result in google when you search for “ruby dependency injection” :laughing:
Lucas Hosseini
@beauby
Nov 12 2016 13:22
I agree on the principle but I think as long as you make sure your objects are not doing too much, I prefer the named parameters version as it prevents messing up the order of arguments.
haha yeah I stumbled upon it by searching eactly that :p
Piotr Solnica
@solnic
Nov 12 2016 13:26
haha #winning ;)
since I moved to dry-container/auto_inject constructors are no longer any of my concerns
Lucas Hosseini
@beauby
Nov 12 2016 13:27
Also I gotta thank you because I heard about hanami for the first time by reading your rant on rails (which I don’t even remember how I stumbled upon)
Piotr Solnica
@solnic
Nov 12 2016 13:28
hah yeah
a positive effect of my wining on the internet
Nikita Shilnikov
@flash-gordon
Nov 12 2016 23:20
otherwise .optional returns a non-constrained sum-type
Piotr Solnica
@solnic
Nov 12 2016 23:35
@flash-gordon me too, struct by definition is constrained to its type (class)
Nikita Shilnikov
@flash-gordon
Nov 12 2016 23:45
gonna fix it ;)
Piotr Solnica
@solnic
Nov 12 2016 23:46
Awesome
I can push a new release tomorrow
Nikita Shilnikov
@flash-gordon
Nov 12 2016 23:52
kk, cool