RFC: std.json sucessor

Sönke Ludwig via Digitalmars-d digitalmars-d at puremagic.com
Sat Aug 23 02:13:21 PDT 2014


Am 23.08.2014 03:05, schrieb Walter Bright:
> On 8/22/2014 2:27 PM, Sönke Ludwig wrote:
>> Am 22.08.2014 20:08, schrieb Walter Bright:
>>> 1. There's no mention of what will happen if it is passed malformed JSON
>>> strings. I presume an exception is thrown. Exceptions are both slow and
>>> consume GC memory. I suggest an alternative would be to emit an "Error"
>>> token instead; this would be much like how the UTF decoding algorithms
>>> emit a "replacement char" for invalid UTF sequences.
>> The latest version now features a LexOptions.noThrow option which
>> causes an
>> error token to be emitted instead. After popping the error token, the
>> range is
>> always empty.
>
> Having a nothrow option may prevent the functions from being attributed
> as "nothrow".

It's a compile time option, so that shouldn't be an issue. There is also 
just a single "throw" statement in the source, so it's easy to isolate.



More information about the Digitalmars-d mailing list