3 ms·
Nobody 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 e
by stouset 2y ago
Nobody 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).