Dne 29.8.2013 16:43, Roman Neuhauser napsal(a):
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?

I do mind them if they behave too differently from hashes (or arrays -- depends on what kind of [] "API" the object presents). This includes behavior of [] when the key is not present.

If they quack enough like a hash, I am happy, as I can mostly forget the differences and thinking about the code becomes easier.

--
David Majda
SUSE Studio developer
http://susestudio.com/
--
To unsubscribe, e-mail: [email protected]
To contact the owner, e-mail: [email protected]

Reply via email to