These are chat archives for dry-rb/chat

29th
May 2016
Tim Riley
@timriley
May 29 2016 05:36
Success with dry-rb/dry-auto_inject#16 ! Will PR it with a few extra tests, then move onto refactoring. Nearly 500 lines is too long for a class file :grimacing:
Tim Riley
@timriley
May 29 2016 07:40
Method#parameters has entirely different data on rubinius :weary:
At least it appears to be a known bug: rubinius/rubinius#3538
We’ll have to fail auto_inject on rbx until that is fixed
Nikita Shilnikov
@flash-gordon
May 29 2016 11:09
@timriley great job! :+1:
Piotr Solnica
@solnic
May 29 2016 11:17
it’s pretty cool that we’re contributing to making rbx and jruby better by finding subtle bugs like that :)
Aleksandar Radunović
@aradunovic
May 29 2016 12:26
Hi all! I have a question about where to register a dependency (core component or sub-app) based on dry-web-skeleton.
My application will consist of JSON API sub-app and admin sub-app.
Now, for API i intend to use Yaks. My intention is to create some kind of wrapper around yaks (maybe called Serialize) which will receive object that needs to be serialized and mapper as #call arguments.
My question is:
Should I register this (Serialize) object in core container or in API sub-app container? I’m in doubt since looking at berg, all “wrappers” are a part of core component, however, in this case, serialization will be performed only for sub-app.
Thanks!
Tim Riley
@timriley
May 29 2016 12:30
@aradunovic I’ve actually used yaks in one of our other dry-web apps. Here’s how I did it:
require "yaks"

module Main
  class JsonSerializer
    Serializer = Yaks.new do
      # yaks config here
    end

    def call(*args)
      Serializer.call(*args)
    end
  end
end
So then it could be fetched from the Main container as Main[“main.json_serializer”]
This message was deleted
Aleksandar Radunović
@aradunovic
May 29 2016 12:36
Interesting. I assumed you would auto-inject alredy configured Yaks instance in Serializer.
Tim Riley
@timriley
May 29 2016 12:37
You could do that too.
But you have to put that instance somewhere.
So your option is to assign it to a constant like I did there, or register it manually with your sub-app’s container.
n.b. with the approach I took, this JsonSerializer basically just “wraps” the yaks instance
so that’s the thing that gets injected into any other object that wants to serialize JSON
Aleksandar Radunović
@aradunovic
May 29 2016 12:44
Oh, I get it…Like I mentioned previously, I don’t expect to use Json serialization in my other sub-apps. So, is that good enough reason to register Serializer only in API sub-app container?
Tim Riley
@timriley
May 29 2016 12:45
Yep, as a general rule I try and restrict things as much as possible.
Aleksandar Radunović
@aradunovic
May 29 2016 12:54
Great. Thank you very much for your help and guidance. I just started exploring dry-web and there are still some things I need to wrap my head around, but IMHO this is truly a great approach!
Tim Riley
@timriley
May 29 2016 12:56
@aradunovic glad you’re liking it so far!
Chase Gilliam
@Ch4s3
May 29 2016 14:27
A lot of cool info is accumulating here, it would be awesome to get some of it into the docs, perhaps into some short tutorials.
Piotr Solnica
@solnic
May 29 2016 14:28
yes we are missing tutorials :(
right now we have usage docs only
and very little API docs, but that’s OK IMO, the libs are unstable
Chase Gilliam
@Ch4s3
May 29 2016 14:29
Well, it's early days, so that's not a big problem. Maybe I can help doc and write up a bit about dry-validation in prep for dry-validation-rails
Piotr Solnica
@solnic
May 29 2016 14:30
that would be great
would be nice to make some buzz and publish some tutorials along with 0.8.0 release
(of dry-v)
Chase Gilliam
@Ch4s3
May 29 2016 14:30
Ok, I'll put that on the list. I'll pester the channel for specifics as I sit down to write it.
Piotr Solnica
@solnic
May 29 2016 14:31
speaking about writing, I started on a follow-up after my last week’s rails article. anybody interested in giving me some early feedback (it’s still WIP)?
Chase Gilliam
@Ch4s3
May 29 2016 14:31
I'll talk it up at my local Ruby group soon.
Yeah, I can take a look this afternoon.
Piotr Solnica
@solnic
May 29 2016 14:32
cool man, thank you. it’s in a gist right here
it’s a short one ;)
Chase Gilliam
@Ch4s3
May 29 2016 14:33
Excellent! I didn't just volunteer to proof a novel!
off topic have you looked at Helix/Rust?
Piotr Solnica
@solnic
May 29 2016 14:33
I did, it doesn’t support modules so I couldn’t use it, I asked about module support in an issue, no reply so far
Chase Gilliam
@Ch4s3
May 29 2016 14:34
Helix you mean?
Piotr Solnica
@solnic
May 29 2016 14:34
si
Chase Gilliam
@Ch4s3
May 29 2016 14:36
Yeah, they seem to have a sort of stable proof of concept. I'm watching eagerly. It hits a sweet spot for me that I think JRuby sort of works for, but I just don't like the ffi with Java very much
Piotr Solnica
@solnic
May 29 2016 14:38
yeah I’m super excited about this, we can make tons of stuff multiple times faster
Chase Gilliam
@Ch4s3
May 29 2016 14:39
Yeah, agreed. And Rust is much nicer to work in than C, and I feel like once I know it I'll probably prefer it to Java.
I wonder if it would be faster for writing validation code since it has pattern matching
Chase Gilliam
@Ch4s3
May 29 2016 14:44
@solnic If I have notes on the article, do you just want them in comments, or direct message here?
Piotr Solnica
@solnic
May 29 2016 14:45
comments are ok :)
Chase Gilliam
@Ch4s3
May 29 2016 14:45
:+1:
Piotr Solnica
@solnic
May 29 2016 14:45
I only wish gh had notifications for gist comments heh
Chase Gilliam
@Ch4s3
May 29 2016 14:46
yeah, that seems like an oversight. I wonder if gist might be a separate application
Piotr Solnica
@solnic
May 29 2016 14:53
they had notifications in gists, then they were removed O_o
but that was before “unsubscribe” was introduced,
too bad they never re-introduced it with unsubs feature this time
Chase Gilliam
@Ch4s3
May 29 2016 14:55
Odd
Chase Gilliam
@Ch4s3
May 29 2016 18:03
@solnic I just posted some notes, mostly about grammar/phrasing and a small note about the argument around abstraction. Overall I really like it!
Piotr Solnica
@solnic
May 29 2016 18:11
@Ch4s3 oh thanks! This is very helpful :) glad you liked it
Chase Gilliam
@Ch4s3
May 29 2016 18:11
Anytime. I like that the discussion is happening
Chase Gilliam
@Ch4s3
May 29 2016 18:19
So what is your involvement with Hanami?
Piotr Solnica
@solnic
May 29 2016 18:20
dry-rb and rom-rb integrations
libs that I've been working on are being integrated as backends for some of the hanami pieces
Piotr Solnica
@solnic
May 29 2016 19:29
@Ch4s3 I’m not really happy with the last part about Rails, it ends rather abruptly and begs for a couple more sentences, just not sure what to write here w/o going too much into details and another rails-bashing-by-accident ;)
Chase Gilliam
@Ch4s3
May 29 2016 19:29
hum...
depends, do you want to be prescriptive and point to where Rails could better serve it purpose? Or, do you want to better define the scope in which you think Rails is the appropriate choice?
Piotr Solnica
@solnic
May 29 2016 19:32
both, actually, but that’s too much for this post
I think I’m gonna remove this paragraph, I may write something more dedicated later
Chase Gilliam
@Ch4s3
May 29 2016 19:33
So the crux to me seems to be that if you plan to build an app like Basecamp, Rails is a good choice. If you plan on building something drastically different, or don't know then Rails may be a bad choice especially in the medium to long term
Yeah, may be best left to a different post
Piotr Solnica
@solnic
May 29 2016 19:35
yep :)
Chase Gilliam
@Ch4s3
May 29 2016 19:39

If you remove it, I would suggest a quick closing summary.

Something along the lines of:
I'm not here to bash Rails, I'm trying to drive a conversation about diversifying the Ruby ecosystem. Ruby needs new frameworks and libraries built on top of solid abstractions. These abstractions should provide services with which a developer can build applications suited to a diverse range of domains. I'm currently building (some projects) to accomplish those goals. If you're interested in a more robust Ruby ecosystem, join us (point to the projects, gitter, or wherever).

Or if that's not quite your goal, just summarize the importance of good abstractions in frameworks

Chase Gilliam
@Ch4s3
May 29 2016 19:45
I'd also hold off publishing it until Tuesday if you want people to discuss it