These are chat archives for dry-rb/chat

22nd
Jul 2015
Piotr Solnica
@solnic
Jul 22 2015 10:04
oh that’s a neat idea
I already thought that this will grow fast so I dunno how to split it up
namespacing like that sounds really simple!
Andy Holland
@AMHOL
Jul 22 2015 10:06
Yeah, not sure it adds much to the code, but it's definitely easier for humans to understand :)
Piotr Solnica
@solnic
Jul 22 2015 10:10
that’s really cool, I think, we’ll see how it works :)
btw I did a sweet little thing for auto-injecting with Concord + Dry::Container
it looks like that, more or less:
class Foo
  extend AutoInject(:baz, :bar)

  def call
    bar.call(baz.call)
  end
end
which basically creates a module and sets up constructor with deps injected from a known container
and returns it, so Foo is extended with it
Andy Holland
@AMHOL
Jul 22 2015 10:12
Cool, constructor injection is much better
What does AutoInject look like?
Piotr Solnica
@solnic
Jul 22 2015 10:13
def AutoInject(*names)
  Module.new do |mod|
    mod.class_variable_set('@@names', names)

    def self.extended(klass)
      names = class_variable_get('@@names')

      klass.class_eval do
        include Concord.new(*names)

        def self.new(*args)
          names = ancestors.detect { |a| a.is_a?(Concord) }.names
          deps = names.map.with_index { |name, i| args[i] || SB.app.container.resolve(name) }
          super(*deps)
        end
      end
    end
  end
end
messy but works
I wrote it yesterday in anger
Andy Holland
@AMHOL
Jul 22 2015 10:14
lol
Piotr Solnica
@solnic
Jul 22 2015 10:14
:D
Andy Holland
@AMHOL
Jul 22 2015 10:15
Nice
Piotr Solnica
@solnic
Jul 22 2015 10:15
it removes helluva code from class definitions
Andy Holland
@AMHOL
Jul 22 2015 10:15
You have stuff registered with call: false then?
Piotr Solnica
@solnic
Jul 22 2015 10:15
and you can still easily track down what the deps are
I register them with blocks
no options
works
Andy Holland
@AMHOL
Jul 22 2015 10:15
Ahh OK
Piotr Solnica
@solnic
Jul 22 2015 10:16
container.register(:persistence) { Persistence.new(resolve(‘rom’)) }
things like that
Andy Holland
@AMHOL
Jul 22 2015 10:16
Just with:
class Foo
  extend AutoInject(:baz, :bar)

  def call
    bar.call(baz.call)
  end
end
And the default resolver, it would call on resolution
Without the call: false option
Ahh, OK, thought you were registering procs because of the example
Piotr Solnica
@solnic
Jul 22 2015 10:18
no just block syntax
btw I feel like I know enough to experiment with my custom rodakase
Andy Holland
@AMHOL
Jul 22 2015 10:20
Cool, I'm not sure I like the roda-action stuff anymore, but the container would be useful
Be interesting to see what you come up with :)
Piotr Solnica
@solnic
Jul 22 2015 10:35
@AMHOL actually I’m more interested in collaborating on something
it’s mostly putting pieces together but I’d prefer to collaborate and work together on something
Andy Holland
@AMHOL
Jul 22 2015 10:35
@solnic Ahh, OK, more than happy to do that :smile:
Piotr Solnica
@solnic
Jul 22 2015 10:35
there’s at least ~5 people who are interested in a roda-based stack
I’m not betting on lotus anymore no matter how much I love Luca and his work, it’s too OO for me :)
Andy Holland
@AMHOL
Jul 22 2015 10:36
I've been thinking it would be nice to get some kind of roda skeleton setup, is that what you're thinking?
I don't mind OO, but I think Lotus is too Rails-like
Piotr Solnica
@solnic
Jul 22 2015 10:38
I do mind OO when it’s full of mutable state
in general, I don’t mind dealing with objects that much
but your comment re being too railsy is true
it’s very close conceptually to rails, which was Luca’s goal anyway, to create better rails
he is very open to collaborating on shared tools so that’s great
his philosophy is really great and inline with mine so I’m sure something good can come out of that ;)
did I just say that my philosophy is great in a convoluted, implicit way? I guess I did I did ;)
Andy Holland
@AMHOL
Jul 22 2015 10:40
haha
Yeah, I think he's achieved that (a better rails)
Piotr Solnica
@solnic
Jul 22 2015 10:40
now I just need to make lotus use ROM
I started experimenting with rom-repository
it’s pretty clear for me how I want it to work (finally)
Andy Holland
@AMHOL
Jul 22 2015 10:41
I saw that, it looks cool
The only thing I think people won't like is the struct thing
But I see why that is necessary
Piotr Solnica
@solnic
Jul 22 2015 10:42
being able to generate mappers and return simple structs feels good and you can always define your own entities explicitly for type-safety and clarity reasons
people won’t like them until they try them, I think
ROM is data-centric so that’s how it manifests itself
Andy Holland
@AMHOL
Jul 22 2015 10:42
Yeah, it's just the mindset of most people means that they won't try it until they like it
Piotr Solnica
@solnic
Jul 22 2015 10:43
that’s a problem but I stopped being worried about that, there’s not much we can do about that except trying to educate
Andy Holland
@AMHOL
Jul 22 2015 10:43
Yep :+1:
No point in letting it damage your code I guess
Piotr Solnica
@solnic
Jul 22 2015 10:43
with limited time and resources it’s hard so unless ROM gets funded and used more widely we will never change that mindset, but it’s fine too
Andy Holland
@AMHOL
Jul 22 2015 10:43
I wanna get to work on that validation library
Piotr Solnica
@solnic
Jul 22 2015 10:44
we have a call with Luca and Nick about validations, wanna join
?
Andy Holland
@AMHOL
Jul 22 2015 10:44
Skype?
Piotr Solnica
@solnic
Jul 22 2015 10:44
you’ll have a great chance to hear italian-, german- and polish-english in just one call :joy:
Andy Holland
@AMHOL
Jul 22 2015 10:44
haha
I can't, I'm at work
Piotr Solnica
@solnic
Jul 22 2015 10:45
yeah Luca just sent an invite, there’s another guy from the US but the call is on Friday
Andy Holland
@AMHOL
Jul 22 2015 10:45
:(
Piotr Solnica
@solnic
Jul 22 2015 10:45
ah right
Andy Holland
@AMHOL
Jul 22 2015 10:45
Ahh, what time?
Piotr Solnica
@solnic
Jul 22 2015 10:45
10am :P
Andy Holland
@AMHOL
Jul 22 2015 10:45
lol, yep, will be at work
Piotr Solnica
@solnic
Jul 22 2015 10:45
that work thing you do man, gotta stop
;)
Andy Holland
@AMHOL
Jul 22 2015 10:45
haha
That would be nice
Piotr Solnica
@solnic
Jul 22 2015 10:45
just stop, be a free man, work 12hrs/day, like me, LOL
Andy Holland
@AMHOL
Jul 22 2015 10:46
I keep playing Lotto
Piotr Solnica
@solnic
Jul 22 2015 10:46
it’s called Lotto in UK too? :D
Andy Holland
@AMHOL
Jul 22 2015 10:46
haha yeah, a FREE man?
Yeah
Lotto and Lotto Euro Millions
Piotr Solnica
@solnic
Jul 22 2015 10:46
sweet, didn’t know that
Andy Holland
@AMHOL
Jul 22 2015 10:46
I need a win on the Euro
Piotr Solnica
@solnic
Jul 22 2015 10:46
I thought Lotto is a polish brand
Andy Holland
@AMHOL
Jul 22 2015 10:46
Nope, is it run by Camelot there?
Piotr Solnica
@solnic
Jul 22 2015 10:47
no idea, I think it’s a national lottery
Andy Holland
@AMHOL
Jul 22 2015 10:47
Yeah, Camelot -> National Lottery = Lotto (AFAIK)
Piotr Solnica
@solnic
Jul 22 2015 10:47
OK :)
hey I gotta run
I’ll describe my rodakase vision and put it in a readme soon
Andy Holland
@AMHOL
Jul 22 2015 10:47
OK :wave:
Piotr Solnica
@solnic
Jul 22 2015 10:48
we could start at least chatting about it :)
cheers
:wave:
Andy Holland
@AMHOL
Jul 22 2015 10:48
Yeah, just give me a shout when you do
Piotr Solnica
@solnic
Jul 22 2015 10:48
will do
Andy Holland
@AMHOL
Jul 22 2015 21:05
@solnic you around?
Piotr Solnica
@solnic
Jul 22 2015 21:08
Kinda
Andy Holland
@AMHOL
Jul 22 2015 21:09
lol, just messing about with the validator stuff
Piotr Solnica
@solnic
Jul 22 2015 21:10
Oh cool. Where?
Andy Holland
@AMHOL
Jul 22 2015 21:10
Not pushed it anywhere yet, just making a gist
The gist vs the comment
I'm leaning towards the gist myself, that would allow the processor to be switched out for nested validations or anything else someone wants to do
Then I can put the extractor/validation container config on the processor
WDYT?
Piotr Solnica
@solnic
Jul 22 2015 21:25
I'll check it out tomorrow. Too late for me already :)
Andy Holland
@AMHOL
Jul 22 2015 21:25
:+1: cheers