A small JSON parsing library

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Thu Feb 14 09:15:37 PST 2013


My eyes are still burning ;-)

Very please with the total absence of type witnesses whatsoever.

Maurizio

On 14/02/13 16:20, Brian Goetz wrote:
>> 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