in reply to the annoying keys "key" and "value"

I don't know what you'd call it, but if for some reason you had a data structure where the key was easier to work with if it weren't stringified, that structure might make sense.

Of course, in that case, I would've used a flat array (key1, val1, key2, val2, ...) or a array of "tuples" (key1,val1, key2,val2, ...). So it's hard to defend the structure you describe, even if I have seen it a lot in verbose APIs -- the serialization of which makes it even less defensible.

  • Comment on Re: the annoying keys "key" and "value"

Replies are listed 'Best First'.
Re^2: the annoying keys "key" and "value"
by LanX (Saint) on Dec 23, 2010 at 21:42 UTC
    > key was easier to work with if it weren't stringified,...

    good point! for example references are difficult to be used as simple keys.

    > I would've used a flat array (key1, val1, key2, val2, ...) or a array of "tuples" ([key1,val1], [key2,val2,] ...).¹

    I'd rather prefer the later, far easier to combine with map or grep.

    Cheers Rolf

    1) missing code tags added