I love how in Ruby doing class DoesStuffService def call(x, y) # ... end end is good design but if you do def do_stuff(x, y) end you're a monster
-
-
Replying to @sgrif
Might have to do with the sad fact that def do_stuff (unnamespaced) ends up on all objects :(
1 reply 0 retweets 1 like -
Replying to @PragTob
Sure, but you have the same issue with constants (though method names are certainly more likely to conflict than constant names). It's a shame we don't have a way to expose functions without affecting global state somewhere.
1 reply 0 retweets 4 likes -
Replying to @sgrif
You can though by attaching it directly to the main object: https://pragtob.wordpress.com/2014/11/19/writing-dsls-in-ruby-without-monkeypatching-object/ …
2 replies 0 retweets 0 likes -
Regarding constants, they can be name spaced and as you mentioned they are much less likely to clash. With all the methods that everyone adds it can be quite harsh (send, open, call etc)
1 reply 0 retweets 0 likes
Here's an example of why I'd love to see a proper module/import system in Ruby. First code is real, second is hypothetical Ruby version. https://gist.github.com/sgrif/4d1a066b8dc6de90d6696aeeeefb6483 …
-
-
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
