News for hackers. Stuff that matters.
Re:I Love Ruby by emmelaich on Tuesday December 19, 2023 @08:13AM (#38695103)
I really like some bits of Ruby but I kept hitting really annoying parts. e.g.

    salary = 100
    bonus = 10
    total = (bonus 
       + salary)
    => 100
Argh. The real example was more complex but you get the idea.
Re:I Love Ruby by jb3689 on Tuesday December 19, 2023 @09:50AM (#38696187)
Wow, I've been using Ruby for a decade and have never run into this. If you are dealing with a codebase written by someone else, then Rubocop probably has a rule for detecting these gotchas. I'd run it across the whole thing and burn down the flags.
Re:I Love Ruby by emmelaich on Tuesday December 19, 2023 @08:56PM (#38704578)
FWIW, I applied Rubocop, it said:

    Lint/Void: Variable bonus used in void context.
Web search for 'ruby void context' finds a bunch of WTFs.