A small JSON parsing library

Brian Goetz brian.goetz at oracle.com
Thu Feb 14 08:20:42 PST 2013

> just to see how it goes, I've written a small all-in-one-file library
> that parses a JSON files to an object tree defined by the user. The
> mapping is specified using lambdas, so it's compact but can burn your
> eyes :)
>    https://github.com/forax/jsonjedi

Very cool!

> During the development, I've found two main gotchas,
> the first one is the scope rules of the lambda parameter,
> I've already sent message about this rule, it seems that eah time I
> write a page of code, the compiler stop me because I tend to re-use the
> same variable name for the very same object.
> In the example named Big [1], the builder of JSON schema is used
> recursively but I've to use a different names each time (builder,
> builder2, builder3).

I can see how this would be annoying to write.  But as a reader, I 
really prefer it!  If all the variables were called "builder", I would 
be confused.  Much easier if I know exactly which builder you are 
referring to -- especially since the declaration -- "builder -> { ..." 
-- often starts near the right margin.

> We should really remove this stupid rule from the JLS and go back to the
> classical shadowing rules.

Your Big.java provides an excellent example why this rule is great!  :)

More information about the lambda-libs-spec-observers mailing list