A small JSON parsing library

Sam Pullara spullara at gmail.com
Thu Feb 14 08:45:09 PST 2013

This rule has also been a pain for me. Since naming is one of the hardest
things in computer science we shouldn't make it any harder.

 On Feb 14, 2013 8:12 AM, "Remi Forax" <forax at univ-mlv.fr> wrote:

> Hi all,
> 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 <https://github.com/forax/jsonjedi>
> The idea is that the JSON parser is triggered by the consumption of the
> corresponding stream,
> so when the code do by example a forEach on a Stream, the parser parse the
> corresponding objects.
> I've used an already existing push parser named json-simple for that.
> 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).
> We should really remove this stupid rule from the JLS and go back to the
> classical shadowing rules.
> The second problem is that the implementation uses method handles to but
> due to the poor integration betweeen method handles and lambdas, I've 20
> lines of boilerplate and error prone code [2] which is moreover executed
> too eagerly.
> cheers,
> Rémi
> [1] https://github.com/forax/**jsonjedi/blob/master/src/Big.**java<https://github.com/forax/jsonjedi/blob/master/src/Big.java>
> [2] https://github.com/forax/**jsonjedi/blob/master/src/**
> jsonjedi/JSONSchemaBuilder.**java#L358<https://github.com/forax/jsonjedi/blob/master/src/jsonjedi/JSONSchemaBuilder.java#L358>

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