logoalt Hacker News

zug_zugyesterday at 7:03 PM5 repliesview on HN

Yeah. I was pretty neutral on ruby, until somewhere I worked some coworker put an @ on a variable relating to sessions and suddenly people started seeing each other's accounts.

Now some people won't fault the language for that, but it feels like a footgun and I've noticed a trend that often the worst (I.e. most dangerous) gravitate toward languages with the fewest safeties in them (less type safety, no compile checks, no memory safety, little concurrency safety, less safety around shared state)


Replies

jchengyesterday at 7:19 PM

Why do you think this is worse than someone saying about Java: "some coworker put `this.` on a variable relating to sessions and suddenly people started seeing each other's accounts"? Because it's less obvious what "@" means rather than "this."?

Edit: I forgot that Java has implicit `this`! That's so, so much worse!

werdnapkyesterday at 8:02 PM

I'm pretty sure you mean @@ on a variable and are not common in a Ruby project. @@ is a class variable and I can see that causing all sorts of problems with data across sessions.

mono442yesterday at 7:25 PM

This can happen it every language. I have seen the same thing happen in a project written in Java when someone has wrongly set the bean scope.

brightballyesterday at 7:21 PM

I have been using Ruby for 13 years and only once have I seen anybody use an @ on a variable…and it was part of a distributed caching strategy for an ad randomizer.

lern_too_spelyesterday at 8:39 PM

How about the fact that Ruby makes immutability difficult, and Hash does not copy keys on write and read? Almost every program uses a hash table, and Ruby makes them especially dangerous.

show 1 reply