Earlier quoted context omitted.
it's not nearly the same. Piping in elixir is a macro; it lets you preserve the other arguments in your function call. The IO.inspect(value, label: "label string") semantic is incredibly powerful. During debugging I often do this: value |> IO.inspect(label: "A") |> do_something |> IO.inspect(label: "B") |> do_something_else |> IO.inspect(label: "C") ... This gives me full visibility over the data transformations that…
That's what it's doing, arguments are preserved: # don't really know what IO.inspect is doing # but guessing something like this? def IO.inspect(value, label:) puts "#{label}: #{value.inspect}" value end value.pipe do IO.inspect(label: "A") do_something IO.inspect(label: "B") do_something_else IO.inspect(label: "C") end
Happy Birthday, Ruby
191–200 of 239 posts
Re: Happy Birthday, Ruby
#192Earlier quoted context omitted.
Cleaner and more idiomatic version: https://news.ycombinator.com/item?id=18873581#18877403
IMO monkey-patching built-in classes is idiomatic Ruby! Edit to add: Actually, now that I think about it, using method_missing would have been even better!
But the edit window had passed by the time I changed it.
Re: Happy Birthday, Ruby
#193Earlier quoted context omitted.
So, I'm old, and have done lots of stuff in lots of languages in frameworks. For about a dozen years, Rails was my go-to toolkit. I've written a couple dozen production applications with it. Unfortunately, Rails has really fallen out of favor lately. Even a Rails-specialty shop I worked for briefly has pivoted to using ASP.NET. I've played around in that stack, and found it lacking. (EF just doesn't compete as an ORM…
Opposite ask: What would your state of the art be for starting something new with Rails? / suggestions to become quickly productive
I've found https://github.com/markets/awesome-ruby a really good resource.
One thing I feel stands out is the graphQL gem. It has an unpolished feel...but dang graphql+active record is a killer combo for rapid development!
Re: Happy Birthday, Ruby
#194Earlier quoted context omitted.
So...eh. Ruby has the easiest data access tools, between ActiveRecord and Sequel (which I prefer), out there. I don't know too many folks who'd disagree with you about that. But where you're happy with Rails taking a few lines, I am as of late big on Kotlin (because I agree with you regarding Java) encouraging me to be correct . I'm building a new product using Spring Boot, Kotlin, and JDBI and while, yes, there's bo…
> Ruby has the easiest data access tools, between ActiveRecord and Sequel Not true
Re: Happy Birthday, Ruby
#195Earlier quoted context omitted.
I don't understand your bit about "cuteness over familiarity". Can you give an example outside that's not Rails-related (given that Rails seems to be the main source of your concrete complaints)? Sigils in Ruby actually do have strong and clear meanings. And the difference between symbols and strings is a useful distinction. And contrary to your statement, Ruby's stdlib is far more complete and more internally consis…
It's not the best example, but Ruby is the only language I can think of where an expression (e) fails to parse but ((e)) parses. I find that it encourages a bad kind of code golf that leads to hard to maintain code.
Re: Happy Birthday, Ruby
#196Earlier quoted context omitted.
Yes, maybe my problem is more with Rails. (Because of monkeypatched APIs, it’s not always obvious to me whether a particular weirdness originates from Ruby’s standard library or is a Rails addition. Arguably this is something the language has also encouraged though.) Is there any reason to use Ruby outside Rails? Its niche seems to completely overlap with Python and modern JavaScript, and those have enormously more e…
I work with Ruby on the web, but rarely with Rails. Apart from the Ruby language itself -- which I love, even though I sympathize with those who don't -- I can't imagine giving up these two libraries by Jeremy Evans: [Sequel]( https://github.com/jeremyevans/sequel ) - Sequel is the best ORM I've ever used, in any language. Fast, stable, unbelievably well maintained, and offers great low-level access to the database w…
Re: Happy Birthday, Ruby
#197Earlier quoted context omitted.
That is why we have pluck
> it's hard to see those consequences at the outset due to the fact that Rails code is so easy to pick up and understand Yes, there are tools in ActiveRecord that can help mitigate some of the performance issues, but as I noted above, it's extremely easy to overlook such tools until you are too far down stream to really do much about it. The symptoms of not using such features may not show up until much later when th…
What's a lot harder to deal with is AR callback hell, which can be very slow if you have enough nested callbacks, and can be really hard to fix without breaking everything. Using many AR callbacks is just a bad idea for a big app!
Re: Happy Birthday, Ruby
#198Earlier quoted context omitted.
So...eh. Ruby has the easiest data access tools, between ActiveRecord and Sequel (which I prefer), out there. I don't know too many folks who'd disagree with you about that. But where you're happy with Rails taking a few lines, I am as of late big on Kotlin (because I agree with you regarding Java) encouraging me to be correct . I'm building a new product using Spring Boot, Kotlin, and JDBI and while, yes, there's bo…
> Ruby has the easiest data access tools, between ActiveRecord and Sequel Not true
Re: Happy Birthday, Ruby
#199Earlier quoted context omitted.
Me too actually. I flirted with programming around uni-time and after - PHP, java, friggin' ada - and just couldn't see myself enjoying it so I went into network management instead. 10 years later I was thoroughly sick of that, so started to look around and heard about this little language called Ruby - and it was love at first sight. Then this little software project called Rails started to gain momentum and there w…
I don't get this Elixir as the natural progression for Rubyists. OO/mutable Ruby and functional/immutable Elixir are worlds apart beyond the superficial syntax similarities.
I never understood this argument. That "superficial" syntax is what I have to stare at, reading and writing, for 8 hours a day. That I actually enjoy doing so is therefore hugely important to me.
I mean, you can make the same argument against Elixir itself, and I've seen it done - Erlang old-timers arguing against the necessity of these "superficial" syntax improvements. Suffice to say that I profoundly disagree.
Re: Happy Birthday, Ruby
#200All my accomplishment happen because of ruby. I've been unhappy and depress with java(2006-2010) and then I manage to move to ruby. And I totally like the language. I'm sad when people say python is more nicer, or the nicer and better language there. I've done python and I never find it appealing as ruby