[getdns-api] Getting from dicts by subscript operator

Joe Hildebrand (jhildebr) jhildebr at cisco.com
Wed Sep 23 19:37:03 UTC 2015

On 9/23/15, 7:37 AM, "Shane Kerr" <shane at time-travellers.org> wrote:

>So I guess that you propose that instead of:
>We would use:
>I think that the last one is "correct" JSON Pointer syntax if I
>understand the RFC, but I confess that the one above it looks easier to
>read to me. :)

The last one.  I know it's slightly strange to a C programmer, but to a JavaScript programmer, it's not *too* strange, where a['foo'] === a.foo.  The advantage here is that in a getdns wrapper that is treating the results as JSON, you could use an existing json-pointer implementation.  Also, you don't have to worry about specifying the BNF for the query syntax, thinking about the edge cases, and worrying about the security consequences quite as much.

Joe Hildebrand

More information about the spec mailing list