John Lam 1997 — 2026

A nice Ruby moment today

I used to have a chunk of code that looked like:

def new_clrobj(ctor_info, sig = null)
  sig = ctor_info.signature if sig == null
  newobj   "#{ctor_info.clr_type}(" + sig.join(',') + ')'
end

It now looks like:

def new_clrobj(ctor_info, sig = ctor_info.signature)
  newobj   "#{ctor_info.clr_type}(" + sig.join(',') + ')'
end

It was one of those “it just works” moments that makes me love this language.