Live data from Hacker News

Implementing a simple object system from scratch in Ruby

metacircu1ar.github.io

1–10 of 11 posts

Re: Implementing a simple object system from scratch in Ruby

#3

Interesting. Why the inconsistent use of hash rockets?

Thanks for spotting this. The parts of code were written at different times. I'll fix this to standardize on :key => value form, as I want symbols to be clearly distinguishable both on call sites and in the method table.

Re: Implementing a simple object system from scratch in Ruby

#4

Interesting. Why the inconsistent use of hash rockets?

Thanks for spotting this. The parts of code were written at different times. I'll fix this to standardize on :key => value form, as I want symbols to be clearly distinguishable both on call sites and in the method table.

Not that it necessarily applies here but any time I see hash rockets in a PR it just screams “an llm wrote this”

Re: Implementing a simple object system from scratch in Ruby

#5

Earlier quoted context omitted.

Thanks for spotting this. The parts of code were written at different times. I'll fix this to standardize on :key => value form, as I want symbols to be clearly distinguishable both on call sites and in the method table.

Not that it necessarily applies here but any time I see hash rockets in a PR it just screams “an llm wrote this”

I write some ruby code for my job to automate some API testing stuff, where I use hash rockets exclusively.

Re: Implementing a simple object system from scratch in Ruby

#7

Ruby really is a powerful language it might not be the fastest or the strictest, but man is it expressive

You are correct technically, but the implication that you must sacrifice speed or static typing is practically incorrect: faster on startup than .NET [0]. You can get benefits similar to static typing in for a while now [1].

[0] tested locally on a Linux environment

[1] https://github.com/ruby/rbs#readme

Re: Implementing a simple object system from scratch in Ruby

#8

Earlier quoted context omitted.

Not that it necessarily applies here but any time I see hash rockets in a PR it just screams “an llm wrote this”

I write some ruby code for my job to automate some API testing stuff, where I use hash rockets exclusively.

You should know that using the hash rocket syntax has not been idiomatic Ruby since the new hash syntax was introduced in 2012. Unless your keys are not symbols, there’s no reason to use hash rockets.

Re: Implementing a simple object system from scratch in Ruby

#10
post #7

Ruby really is a powerful language it might not be the fastest or the strictest, but man is it expressive

You are correct technically, but the implication that you must sacrifice speed or static typing is practically incorrect: faster on startup than .NET [0]. You can get benefits similar to static typing in for a while now [1]. [0] tested locally on a Linux environment [1] https://github.com/ruby/rbs#readme

> faster on startup than .NET [0]

This is unlikely. When you invoke 'dotnet run' you're essentially going through the entire build system, it doesn't "just" launch the application - it also builds it or verifies that it doesn't need to.

The actual startup time for compiled applications is Feel free to verify this with:

  dotnet new console --aot
  dotnet publish -o .
  hyperfine ./{name of the program}
(make sure to use up-to-date version of the SDK, can be installed with sudo apt install dotnet9 / brew install dotnet)

Of course performance of the code itself is going to have more than an order of magnitude of difference: https://benchmarksgame-team.pages.debian.net/benchmarksgame/...

Post reply on HN