On 8/23/14, 10:46 AM, Walter Bright wrote:
On 8/23/2014 10:42 AM, Sönke Ludwig wrote:
Am 23.08.2014 19:38, schrieb Walter Bright:
On 8/23/2014 9:36 AM, Sönke Ludwig wrote:
input types "string" and "immutable(ubyte)[]"

Why the immutable(ubyte)[] ?

I've adopted that basically from Andrei's module. The idea is to allow
processing data with arbitrary character encoding. However, the output
will
always be Unicode and JSON is defined to be encoded as Unicode, too,
so that
could probably be dropped...

I feel that non-UTF encodings should be handled by adapter algorithms,
not embedded into the JSON lexer, so yes, I'd drop that.

I think accepting ubyte it's a good idea. It means "got this stream of bytes off of the wire and it hasn't been validated as a UTF string". It also means (which is true) that the lexer does enough validation to constrain arbitrary bytes into text, and saves caller from either a check (expensive) or a cast (unpleasant).

Reality is the JSON lexer takes ubytes and produces tokens.


Andrei

Reply via email to