# [email protected] / 2013-08-29 16:10:14 +0200:
> Nothing is black and white and one has to think about degrees of
> various positive and negative effects (even of the same kind) in
> different situations. In case of hashes with defaults, the positive
> effects seems small (a bit of DRY) and the negative ones large (big
> surprise at call site).
back to serious mode (on my part).
you said:
> To illustrate this, imagine I am debugging something and see code like
> this:
>
> result = my_hash["key"]
this is a strawman, nobody sane names their variables "my_hash".
so let's say we have this code:
def parse input, options
Parser.new(options['strict']).parse(input)
end
you have no idea what type `options` is, all you know (actually hope
for) is it has a `[](key)` method.
looking at it from the other side, how come you don't mind objects
with `[](key)`? they are *not* Hash, they have all kinds of
"unexpected" behaviors, so really, what's the difference?
--
roman
--
To unsubscribe, e-mail: [email protected]
To contact the owner, e-mail: [email protected]