2 ms·
No need to go all 'comic book guy'. What I'm talking about, of course, is the way that people expect classes to be defined in Ruby, which is going to be less co
by davidw 2y ago
No need to go all 'comic book guy'. What I'm talking about, of course, is the way that people expect classes to be defined in Ruby, which is going to be less confusing and easier to read because it's what everyone is used to.
- dragonwriter 2y agoClass factory methods like Struct.new have been a idiomatic and familiar-to-everyone-using-Ruby and commonly encountered way of creating classes in Ruby for at least as long as I have been using Ruby (since about the turn of the millenium.)
- stouset 2y agoNobody in Ruby is getting tripped up over Point = Data.new(:x, :y) do def len Math.sqrt(x**2 + y**2) end end For one, Struct has existed since basically the beginning of time and works exactly the same way (sans the immutability and some nice auto-implemented features).