News for hackers. Stuff that matters.
Re:Moment of Ruby: An Argument for Nothing by koolba on Thursday November 05, 2026 @07:21AM (#50378247)
What happens if you pass in (nothing_provided = true) as the value?

Does it return back the empty current value?

I’m no ruby expert, but seems like the freeze approach avoids that with a unique inaccessible object.

Re:Moment of Ruby: An Argument for Nothing by XYen0n on Thursday November 05, 2026 @07:46AM (#50378450)
This expression returns true. It should be in a different scope from the default parameter value, so I assume it is equivalent to passing true directly.
Re:Moment of Ruby: An Argument for Nothing by vidarh on Thursday November 05, 2026 @08:40AM (#50378934)
If you pass in (nothing_provided = true), the method received "true" as its argument, not the expression, so it acts exactly as if you pass in true.