Live data from Hacker News

Do I not like Ruby anymore? (2024)

sgt.hootr.club

111–120 of 184 posts

Re: Do I not like Ruby anymore? (2024)

#111

It's the never ending "end"s that bother me about Ruby. class Mess def chaos(x) if x > 0 [1,2,3].each do |i| case i when 1 if i.odd? puts "odd" else puts "even" end when 2 begin puts "trying" rescue puts "failed" end else puts "other" end end else puts "negative" end end end Clear away all those ends and the program logic pops out. Much fresher! class Mess: def chaos(self, x): if x > 0: for i in [1, 2, 3]: match i: c…

It's not Ruby, it's your code... :D

class Mess

  OUTPUTS = {
    1 => ->(i) { i.odd? ? "odd" : "even" },
    2 => ->(_) { "trying" },
    3 => ->(_) { "other" }
  }.freeze

  def chaos(x)
    return puts "negative" unless x.positive?
    
    [1, 2, 3].each do |i|
      puts OUTPUTS[i]&.call(i) || "other"
    end
  end
end

Re: Do I not like Ruby anymore? (2024)

#112

It's the never ending "end"s that bother me about Ruby. class Mess def chaos(x) if x > 0 [1,2,3].each do |i| case i when 1 if i.odd? puts "odd" else puts "even" end when 2 begin puts "trying" rescue puts "failed" end else puts "other" end end else puts "negative" end end end Clear away all those ends and the program logic pops out. Much fresher! class Mess: def chaos(self, x): if x > 0: for i in [1, 2, 3]: match i: c…

It's not Ruby, it's your code... :D class Mess OUTPUTS = { 1 => ->(i) { i.odd? ? "odd" : "even" }, 2 => ->(_) { "trying" }, 3 => ->(_) { "other" } }.freeze def chaos(x) return puts "negative" unless x.positive? [1, 2, 3].each do |i| puts OUTPUTS[i]&.call(i) || "other" end end end

And I have no idea why HN messes up my class statement... it looks good in the text field :D

Re: Do I not like Ruby anymore? (2024)

#113
post #84
post #11

Back when autocompletion and stuff were only available in Visual Studio/Xcode/Other bug IDEs, I was forced to use Ruby and fell in love with it. It didn't matter what I used as my editor was Sublime. But when VSCode came and language features became democratized, I never touched a type-less language again. Why should someone opt for a language with absolutely no features where one can have autocompletion, typecheckin…

> it’s a shame no language is as beautiful as Ruby [...] I really think it's a bad choice of Ruby not to care for types Do you think Ruby could change something so fundamental as dynamic => static typing and still retain its beauty? The only static typing solution I've seen for Ruby is Sorbet, and it's... not beautiful.

Crystal [0] is what comes to mind. I've spent very little time with it, but I find the syntax very appealing.

[0] https://crystal-lang.org/

Re: Do I not like Ruby anymore? (2024)

#114
post #84
post #11

Back when autocompletion and stuff were only available in Visual Studio/Xcode/Other bug IDEs, I was forced to use Ruby and fell in love with it. It didn't matter what I used as my editor was Sublime. But when VSCode came and language features became democratized, I never touched a type-less language again. Why should someone opt for a language with absolutely no features where one can have autocompletion, typecheckin…

> it’s a shame no language is as beautiful as Ruby [...] I really think it's a bad choice of Ruby not to care for types Do you think Ruby could change something so fundamental as dynamic => static typing and still retain its beauty? The only static typing solution I've seen for Ruby is Sorbet, and it's... not beautiful.

One of the main devs on Sorbet would agree: https://blog.jez.io/history-of-sorbet-syntax/

Re: Do I not like Ruby anymore? (2024)

#115
"I consider TypeScript to be the gold standard when it comes to type systems on top of dynamic languages."

Doubly weird, considering that TypeScript work was inspired by typed/racket, and TypeScript doesn't have a sound type system afaik and the OP's first love was Scheme.

Re: Do I not like Ruby anymore? (2024)

#116
post #84
post #11

Back when autocompletion and stuff were only available in Visual Studio/Xcode/Other bug IDEs, I was forced to use Ruby and fell in love with it. It didn't matter what I used as my editor was Sublime. But when VSCode came and language features became democratized, I never touched a type-less language again. Why should someone opt for a language with absolutely no features where one can have autocompletion, typecheckin…

> it’s a shame no language is as beautiful as Ruby [...] I really think it's a bad choice of Ruby not to care for types Do you think Ruby could change something so fundamental as dynamic => static typing and still retain its beauty? The only static typing solution I've seen for Ruby is Sorbet, and it's... not beautiful.

Based on what Ive read [1], Sorbet was born out of very specific circumstances at Stripe, in the same sort of way that go was at google. I think it missed the mark due to it being a specific tool for specific usecases instead of an "open source project for the general public" first.

I love ruby but I do look forward to having a good option for types at some point. The community makes up for lack of types by adding more tests to their test suite, which is nice but I'd love to layer some encoding into the codebase itself and save the CI time.

[1] - https://blog.jez.io/history-of-sorbet-syntax/

Re: Do I not like Ruby anymore? (2024)

#117
post #74
post #11

Back when autocompletion and stuff were only available in Visual Studio/Xcode/Other bug IDEs, I was forced to use Ruby and fell in love with it. It didn't matter what I used as my editor was Sublime. But when VSCode came and language features became democratized, I never touched a type-less language again. Why should someone opt for a language with absolutely no features where one can have autocompletion, typecheckin…

As someone coming from Ruby to TypeScript, I find types cumbersome, verbose, complex, and not of much use. I have been writing and reading TS for the past six months. What am I missing?

Have you sat down to actually learn them? If you're still guessing at them, they're going to be hard. I'd recommend https://type-level-typescript.com/

Re: Do I not like Ruby anymore? (2024)

#118
post #74
post #11

Back when autocompletion and stuff were only available in Visual Studio/Xcode/Other bug IDEs, I was forced to use Ruby and fell in love with it. It didn't matter what I used as my editor was Sublime. But when VSCode came and language features became democratized, I never touched a type-less language again. Why should someone opt for a language with absolutely no features where one can have autocompletion, typecheckin…

As someone coming from Ruby to TypeScript, I find types cumbersome, verbose, complex, and not of much use. I have been writing and reading TS for the past six months. What am I missing?

Id guess its a combination of good editor support for implied types (eg vscode is first-rate at this), plus you likely lean heavily into the test suite when you could likely remove some tests and replace them with better types.

Re: Do I not like Ruby anymore? (2024)

#119

Earlier quoted context omitted.

LSP (Language Server Protocol) was the final nail in the coffin of Emacs for me. VSCode was "good enough" for pretty much every language with LSP at that point, I did't even bother with Jetbrains ides outside of work after that. And when Obsidian replaced org-mode for me, I deleted my .emacs directory from my dotfiles repository.

> LSP (Language Server Protocol) was the final nail in the coffin of Emacs for me. It was the opposite for me. Emacs + LSP + many other common conveniences all bind together so beautifully and efficiently that I can't imagine using any other IDE at this point.

Same. It's easy to setup and use. As is gptel, aidermacs, and claude code ide.
Post reply on HN