Hacker News new | ask | show | jobs
by thowaway91234 941 days ago
As a lifelong rubyist, this is definitely what I would say "useless". Maybe it's just because I've been stuck in Ruby 2.6 ~~hell~~ land for so long but I remember seeing a colleagues leetcode challenge for a job interview that used Ruby 3.1 and he used a bunch of these new syntax sugars and I was really rubbed the wrong way by them. Code the omits arguments is neither more readable (what exactly is getting passed around here?) or maintable (what happens when you have some condition that may apply to one of the arguments, then you just need to unwrap all the "nice" things and do it more traditionally).

The elipsis ... especially rubs me the wrong way because multiple periods either .. or ... denotes range types, but now we have a special case where ... is something completely different. Bah humbug.

They seem nice in clean blog scenarios with trivial examples, but in my experience they are not conducive to writing readable and maintable code.

Thankfully I can just disable their use in my projects (for the most part) with rubocop. All the hip young kids can write their magic code, I'll stick to more straightforward constructs that anyone can figure out.

2 comments

It actually really helps with maintenance.

If you have a wrapper for an API (say, that does some logging or whatever), you can use `…` to forward arguments, maintenance free.

Perhaps the wrapped function started out with no arg, but then added one. You never took/forwarded a `*vargs` array, so now you have to manually update that.

Then perhaps some other function started taking a block. Now you need to add `&block` and forward it.

So `…` is a maintenance-free way to forward arguments to functions that are free to change.

I’ve been using Ruby since 1.7 and think the new syntax is fantastic. I hope you’re not weaponizing Rubocop in team or community projects in a manner that discourages “hip young” Rubyists from learning and exploring new ways of pushing the language & runtime forward.
We have developers of various experience and skillsets that come and go, sticking to a subset of language features with minimal magic has made it easier to onboard and get people productive. We have massive codebase, and sprinkling these new sugars around in arbitrary places to be lindmines for them isn't worth it to me. From a business perspective, we're not too concerned about pushing the language forward, we're focused on creating value for our customers - the language is just a detail.
If the language is “just a detail”, then why go through the trouble of writing about your distaste of new syntax features in Ruby? Using new language features does not categorically hurt or help “create value for customers”.
Not the originator, addressing only your question, the hacker news commenting system is a form social media. People are free to comment as they see fit and for reasons that make sense to them, within certain guidelines that don’t appear to apply here. My impression is your comment, and previously theirs, is an airing of grievance. Which is common and par for the course in social media spaces. My intention in commenting is to give a voice to what is typically an unspoken understanding.