--f46d041826261d3c6e04b69eab37
Content-Type: text/plain; charset=ISO-8859-1

On Sun, Jan 15, 2012 at 6:30 PM, Intransition <transfire / gmail.com> wrote:

> Which would you judge to be the better code?
>
> The concise:
>
>     def self.assert(*a, &b)
>       o  ash  a.last ? a.pop : {}
>
>       t  [:backtrace] || caller
>       m  [:message]
>
>       e  ew(m, *a, &b)
>       e.set_backtrace(t)
>       e.assert
>     end
>
> Or the more explicit:
>
>     def self.assert(*arguments, &block)
>       options  Hash  arguments.last ? arguments.pop : {})
>
>       backtrace  ptions[:backtrace] || caller
>       message    ptions[:message]
>
>       assay  ew(message, *arguments, &block)
>       assay.set_backtrace(backtrace)
>       assay.assert
>     end
>
> Which and why?
>

Explicit, because I was able to understand it. On the first one, when I got
to the new, I was confused about the params being passed in. I also like
how it uses parens on the ternary during assignment, because otherwise the
syntax is confusing. I don't think it needs the parens after `new` and
`set_backtrace`, my preference is the minimum amount of syntax such that
the idea is clear.

As an asside, it's unclear to me why it's set_backtrace rather than
backtrace-f46d041826261d3c6e04b69eab37--