Re: RFC: std.json sucessor

2015-02-05 Thread Sönke Ludwig via Digitalmars-d
Am 05.02.2015 um 10:07 schrieb Jakob Ovrum: On Thursday, 21 August 2014 at 22:35:18 UTC, Sönke Ludwig wrote: ... Added to the review queue as a work in progress with relevant links: http://wiki.dlang.org/Review_Queue Thanks! I(t) should be ready for an official review in one or two wee

Re: RFC: std.json sucessor

2015-02-05 Thread Andrei Alexandrescu via Digitalmars-d
On 2/5/15 1:07 AM, Jakob Ovrum wrote: On Thursday, 21 August 2014 at 22:35:18 UTC, Sönke Ludwig wrote: ... Added to the review queue as a work in progress with relevant links: http://wiki.dlang.org/Review_Queue Yay! -- Andrei

Re: RFC: std.json sucessor

2015-02-05 Thread Jakob Ovrum via Digitalmars-d
On Thursday, 21 August 2014 at 22:35:18 UTC, Sönke Ludwig wrote: ... Added to the review queue as a work in progress with relevant links: http://wiki.dlang.org/Review_Queue

Re: RFC: std.json sucessor

2014-10-20 Thread David Soria Parra via Digitalmars-d
On Saturday, 18 October 2014 at 19:53:23 UTC, Sean Kelly wrote: Python 0.499547972114 0.499779920774 0.499811461578 12.01s, 1355.1Mb I assume this is the standard json module? I am wondering how ujson is performing, which is considered the fastest python module.

Re: RFC: std.json sucessor

2014-10-19 Thread Ary Borenszweig via Digitalmars-d
On 10/18/14, 4:53 PM, Sean Kelly wrote: On Friday, 17 October 2014 at 18:27:34 UTC, Ary Borenszweig wrote: Once its done you can compare its performance against other languages with this benchmark: https://github.com/kostya/benchmarks/tree/master/json Wow, the C++Rapid parser is really impre

Re: RFC: std.json sucessor

2014-10-18 Thread Sean Kelly via Digitalmars-d
On Saturday, 18 October 2014 at 19:53:23 UTC, Sean Kelly wrote: On Friday, 17 October 2014 at 18:27:34 UTC, Ary Borenszweig wrote: Once its done you can compare its performance against other languages with this benchmark: https://github.com/kostya/benchmarks/tree/master/json Wow, the C++Ra

Re: RFC: std.json sucessor

2014-10-18 Thread Sean Kelly via Digitalmars-d
On Friday, 17 October 2014 at 18:27:34 UTC, Ary Borenszweig wrote: Once its done you can compare its performance against other languages with this benchmark: https://github.com/kostya/benchmarks/tree/master/json Wow, the C++Rapid parser is really impressive. I threw together a test with m

Re: RFC: std.json sucessor

2014-10-17 Thread Ary Borenszweig via Digitalmars-d
On 8/21/14, 7:35 PM, Sönke Ludwig wrote: Following up on the recent "std.jgrandson" thread [1], I've picked up the work (a lot earlier than anticipated) and finished a first version of a loose blend of said std.jgrandson, vibe.data.json and some changes that I had planned for vibe.data.json for a

Re: RFC: std.json sucessor

2014-10-13 Thread Andrei Alexandrescu via Digitalmars-d
On 10/13/14, 4:45 AM, Sönke Ludwig wrote: Am 13.10.2014 13:33, schrieb Jacob Carlborg: On 13/10/14 09:39, Sönke Ludwig wrote: ** At four words per token, Location seems pretty bulky. How about reducing line and column to uint? Single line JSON files >64k (or line counts >64k) are no exceptio

Re: RFC: std.json sucessor

2014-10-13 Thread Andrei Alexandrescu via Digitalmars-d
On 10/13/14, 4:48 AM, Sönke Ludwig wrote: Am 13.10.2014 13:37, schrieb Jacob Carlborg: On 22/08/14 00:35, Sönke Ludwig wrote: Following up on the recent "std.jgrandson" thread [1], I've picked up the work (a lot earlier than anticipated) and finished a first version of a loose blend of said std

Re: RFC: std.json sucessor

2014-10-13 Thread Sönke Ludwig via Digitalmars-d
Am 13.10.2014 13:37, schrieb Jacob Carlborg: On 22/08/14 00:35, Sönke Ludwig wrote: Following up on the recent "std.jgrandson" thread [1], I've picked up the work (a lot earlier than anticipated) and finished a first version of a loose blend of said std.jgrandson, vibe.data.json and some changes

Re: RFC: std.json sucessor

2014-10-13 Thread Sönke Ludwig via Digitalmars-d
Am 13.10.2014 13:33, schrieb Jacob Carlborg: On 13/10/14 09:39, Sönke Ludwig wrote: ** At four words per token, Location seems pretty bulky. How about reducing line and column to uint? Single line JSON files >64k (or line counts >64k) are no exception 64k? Oh, I've read "both line and co

Re: RFC: std.json sucessor

2014-10-13 Thread Jacob Carlborg via Digitalmars-d
On 22/08/14 00:35, Sönke Ludwig wrote: Following up on the recent "std.jgrandson" thread [1], I've picked up the work (a lot earlier than anticipated) and finished a first version of a loose blend of said std.jgrandson, vibe.data.json and some changes that I had planned for vibe.data.json for a w

Re: RFC: std.json sucessor

2014-10-13 Thread Jacob Carlborg via Digitalmars-d
On 13/10/14 09:39, Sönke Ludwig wrote: ** At four words per token, Location seems pretty bulky. How about reducing line and column to uint? Single line JSON files >64k (or line counts >64k) are no exception 64k? -- /Jacob Carlborg

Re: RFC: std.json sucessor

2014-10-13 Thread Sönke Ludwig via Digitalmars-d
Am 12.10.2014 23:52, schrieb Sean Kelly: Oh, it looks like you aren't checking for 0x7F (DEL) as a control character. It doesn't get mentioned in the JSON spec, so I left it out. But I guess nothing speaks against adding it anyway.

Re: RFC: std.json sucessor

2014-10-13 Thread Sönke Ludwig via Digitalmars-d
Am 12.10.2014 21:04, schrieb Sean Kelly: I'd like to see unescapeStringLiteral() made public. Then I can unescape multiple strings to the same preallocated destination, or even unescape in place (guaranteed to work since the result will always be smaller than the input). Will do. Same for the

Re: RFC: std.json sucessor

2014-10-13 Thread Sönke Ludwig via Digitalmars-d
Am 12.10.2014 20:17, schrieb Andrei Alexandrescu: Here's my destruction of std.data.json. * lexer.d: ** Beautifully done. From what I understand, if the input is string or immutable(ubyte)[] then the strings are carved out as slices of the input, as opposed to newly allocated. Awesome. ** The

Re: RFC: std.json sucessor

2014-10-12 Thread Sean Kelly via Digitalmars-d
Oh, it looks like you aren't checking for 0x7F (DEL) as a control character.

Re: RFC: std.json sucessor

2014-10-12 Thread Sean Kelly via Digitalmars-d
On Sunday, 12 October 2014 at 18:17:29 UTC, Andrei Alexandrescu wrote: ** The string after lexing is correctly scanned and stored in raw format (escapes are not rewritten) and decoded on demand. Problem with decoding is that it may allocate memory, and it would be great (and not difficult) to

Re: RFC: std.json sucessor

2014-10-12 Thread Andrei Alexandrescu via Digitalmars-d
Here's my destruction of std.data.json. * lexer.d: ** Beautifully done. From what I understand, if the input is string or immutable(ubyte)[] then the strings are carved out as slices of the input, as opposed to newly allocated. Awesome. ** The string after lexing is correctly scanned and sto

Re: RFC: std.json sucessor

2014-09-08 Thread Atila Neves via Digitalmars-d
Been using it for a bit now, I think the only thing I have to say is having to insert all of those `JSONValue` everywhere is tiresome and I never know when I have to do it. Atila On Thursday, 21 August 2014 at 22:35:18 UTC, Sönke Ludwig wrote: Following up on the recent "std.jgrandson" thread

Re: RFC: std.json sucessor

2014-08-28 Thread via Digitalmars-d
Kahan states this in a 1997 paper: «[…]An SNaN may be moved ( copied ) without incident, but any other arithmetic operation upon an SNaN is an INVALID operation ( and so is loading one onto the ix87's stack ) that must trap or else produce a new nonsignaling NaN. ( Another way to turn an SNaN

Re: RFC: std.json sucessor

2014-08-28 Thread via Digitalmars-d
Let me try again: SNAN => unfortunately absent QNAN => deliberately absent So you can have: compute(SNAN) => handle(exception) { if(can turn unfortunate situation into deliberate) then compute(QNAN) else throw )

Re: RFC: std.json sucessor

2014-08-28 Thread via Digitalmars-d
On Thursday, 28 August 2014 at 14:43:30 UTC, Don wrote: No. Once you load an SNAN, it isn't an SNAN any more! It is a QNAN. By which definition? It is only if you consume the SNAN with an fp-exception-free arithmetic op that it should be turned into a QNAN. If you compute with an op that thr

Re: RFC: std.json sucessor

2014-08-28 Thread Don via Digitalmars-d
On Thursday, 28 August 2014 at 12:10:58 UTC, Ola Fosheim Grøstad wrote: Or to be more explicit: If have SNAN then there is no point in trying to recompute the expression using a different algorithm. If have QNAN then you might want to recompute the expression using a different algorithm (e.g

Re: RFC: std.json sucessor

2014-08-28 Thread via Digitalmars-d
Or to be more explicit: If have SNAN then there is no point in trying to recompute the expression using a different algorithm. If have QNAN then you might want to recompute the expression using a different algorithm (e.g. complex numbers or analytically). ?

Re: RFC: std.json sucessor

2014-08-28 Thread via Digitalmars-d
On Thursday, 28 August 2014 at 11:09:16 UTC, Don wrote: I think the way to think of it is, to the programmer, there is *no such thing* as an snan value. It's an implementation detail that should be invisible. Semantically, a signalling nan is a qnan value with a hardware breakpoint on it. I d

Re: RFC: std.json sucessor

2014-08-28 Thread Don via Digitalmars-d
On Wednesday, 27 August 2014 at 23:51:54 UTC, Walter Bright wrote: On 8/26/2014 12:24 AM, Don wrote: On Monday, 25 August 2014 at 23:29:21 UTC, Walter Bright wrote: On 8/25/2014 4:15 PM, "Ola Fosheim Grøstad" " wrote: On Monday, 25 August 2014 at 21:24:11 UTC, Walter Bright wrote: I didn't kno

Re: RFC: std.json sucessor

2014-08-27 Thread Walter Bright via Digitalmars-d
On 8/26/2014 12:24 AM, Don wrote: On Monday, 25 August 2014 at 23:29:21 UTC, Walter Bright wrote: On 8/25/2014 4:15 PM, "Ola Fosheim Grøstad" " wrote: On Monday, 25 August 2014 at 21:24:11 UTC, Walter Bright wrote: I didn't know that. But recall I did implement it in DMC++, and it turned out t

Re: RFC: std.json sucessor

2014-08-26 Thread Sönke Ludwig via Digitalmars-d
Am 26.08.2014 16:51, schrieb Sönke Ludwig: Am 26.08.2014 16:40, schrieb Don: This is the difference: if you get NaN or Infinity, there's probably a straightforward bug in the Javascript code, but your D code is fine. Any other kind of JSON parsing error means you've got a garbage string that isn

Re: RFC: std.json sucessor

2014-08-26 Thread via Digitalmars-d
On Tuesday, 26 August 2014 at 14:40:02 UTC, Don wrote: This is the difference: if you get NaN or Infinity, there's probably a straightforward bug in the Javascript code, but your D code is fine. Any other kind of JSON parsing error means you've got a garbage string that isn't JSON at all. They

Re: RFC: std.json sucessor

2014-08-26 Thread Sönke Ludwig via Digitalmars-d
Am 26.08.2014 16:40, schrieb Don: On Tuesday, 26 August 2014 at 14:06:42 UTC, Sönke Ludwig wrote: Am 26.08.2014 15:43, schrieb Don: On Monday, 25 August 2014 at 14:04:12 UTC, Sönke Ludwig wrote: Am 25.08.2014 15:07, schrieb Don: ie this should be parsable: {"foo": NaN, "bar": Infinity, "baz"

Re: RFC: std.json sucessor

2014-08-26 Thread Don via Digitalmars-d
On Tuesday, 26 August 2014 at 14:06:42 UTC, Sönke Ludwig wrote: Am 26.08.2014 15:43, schrieb Don: On Monday, 25 August 2014 at 14:04:12 UTC, Sönke Ludwig wrote: Am 25.08.2014 15:07, schrieb Don: ie this should be parsable: {"foo": NaN, "bar": Infinity, "baz": -Infinity} This would probably

Re: RFC: std.json sucessor

2014-08-26 Thread via Digitalmars-d
On Tuesday, 26 August 2014 at 13:43:56 UTC, Ola Fosheim Grøstad wrote: Anyway, the x87 FP stack is history, even MOVSS is considered legacy by Intel… Sorry for being off-topic, but MOVSS and VMOVSS on AMD don't throw FP exceptions either, but calculations does. So it seems like AMD and Intel

Re: RFC: std.json sucessor

2014-08-26 Thread Sönke Ludwig via Digitalmars-d
Am 26.08.2014 15:43, schrieb Don: On Monday, 25 August 2014 at 14:04:12 UTC, Sönke Ludwig wrote: Am 25.08.2014 15:07, schrieb Don: ie this should be parsable: {"foo": NaN, "bar": Infinity, "baz": -Infinity} This would probably best added as another (CT) optional feature. I think the default

Re: RFC: std.json sucessor

2014-08-26 Thread via Digitalmars-d
On Tuesday, 26 August 2014 at 13:24:11 UTC, Don wrote: No, it's more subtle. On the original x87, signalling NaNs are triggered for 64 bits loads, but not for 80 bit loads. You have to read the fine print to discover this. You are right, but it happens for loads from the FP-stack too: «Source

Re: RFC: std.json sucessor

2014-08-26 Thread Don via Digitalmars-d
On Monday, 25 August 2014 at 14:04:12 UTC, Sönke Ludwig wrote: Am 25.08.2014 15:07, schrieb Don: On Thursday, 21 August 2014 at 22:35:18 UTC, Sönke Ludwig wrote: Following up on the recent "std.jgrandson" thread [1], I've picked up the work (a lot earlier than anticipated) and finished a first

Re: RFC: std.json sucessor

2014-08-26 Thread Don via Digitalmars-d
On Tuesday, 26 August 2014 at 12:37:58 UTC, Ola Fosheim Grøstad wrote: On Tuesday, 26 August 2014 at 10:55:20 UTC, Don wrote: It was always in IEEE754. The decision in 754-2008 was simply to not remove it from the spec (a lot of people wanted to remove it). I don't think anything has changed.

Re: RFC: std.json sucessor

2014-08-26 Thread via Digitalmars-d
With the danger of being noisy, these instructions are subject to floating point exceptions according to my (perhaps sloppy) reading of Intel Architecture Instruction Set Extensions Programming Reference (2012): (V)ADDPD, (V)ADDPS, (V)ADDSUBPD, (V)ADDSUBPS, (V)CMPPD, (V)CMPPS, (V)CVTDQ2PS, (V

Re: RFC: std.json sucessor

2014-08-26 Thread via Digitalmars-d
On Tuesday, 26 August 2014 at 12:37:58 UTC, Ola Fosheim Grøstad wrote: either. AVX is quite complicated, but searching for "signaling" gives some hints about the semantics you can rely on. … https://software.intel.com/sites/default/files/managed/c6/a9/319433-020.pdf (Actually, searching for

Re: RFC: std.json sucessor

2014-08-26 Thread via Digitalmars-d
On Tuesday, 26 August 2014 at 10:55:20 UTC, Don wrote: It was always in IEEE754. The decision in 754-2008 was simply to not remove it from the spec (a lot of people wanted to remove it). I don't think anything has changed. It was implementation defined before. I think they specified the bit i

Re: RFC: std.json sucessor

2014-08-26 Thread David Soria Parra via Digitalmars-d
On Thursday, 21 August 2014 at 22:35:18 UTC, Sönke Ludwig wrote: Following up on the recent "std.jgrandson" thread [1], I've picked up the work (a lot earlier than anticipated) and finished a first version of a loose blend of said std.jgrandson, vibe.data.json and some changes that I had plann

Re: RFC: std.json sucessor

2014-08-26 Thread Don via Digitalmars-d
On Tuesday, 26 August 2014 at 07:34:05 UTC, Ola Fosheim Gr wrote: On Tuesday, 26 August 2014 at 07:24:19 UTC, Don wrote: Processors from AMD have signalling NaN behaviour which is different from processors from Intel. And the situation is worst on most other architectures. It's a lost cause,

Re: RFC: std.json sucessor

2014-08-26 Thread Sönke Ludwig via Digitalmars-d
Am 26.08.2014 11:11, schrieb "Ola Fosheim Grøstad" ": On Tuesday, 26 August 2014 at 09:05:05 UTC, Sönke Ludwig wrote: When on the other hand a ubyte/ushort/uint range is used, the lexer should validate all string literals. Yes, so this will be supported? Because this is what is most useful.

Re: RFC: std.json sucessor

2014-08-26 Thread Entusiastic user via Digitalmars-d
I tried using "-disable-linker-strip-dead", but it had no effect. From the error messages it seems the problem is compile-time and not link-time... On Tuesday, 26 August 2014 at 07:01:09 UTC, Jacob Carlborg wrote: On 25/08/14 21:49, simendsjo wrote: So ldc can remove quite a substantial amo

Re: RFC: std.json sucessor

2014-08-26 Thread via Digitalmars-d
On Tuesday, 26 August 2014 at 09:05:05 UTC, Sönke Ludwig wrote: When on the other hand a ubyte/ushort/uint range is used, the lexer should validate all string literals. Yes, so this will be supported? Because this is what is most useful.

Re: RFC: std.json sucessor

2014-08-26 Thread Sönke Ludwig via Digitalmars-d
Am 26.08.2014 10:24, schrieb "Ola Fosheim Grøstad" ": On Tuesday, 26 August 2014 at 07:51:04 UTC, Sönke Ludwig wrote: That's true. So the ideal solution would be to *assume* UTF-8 when the input is char based and to *validate* if the input is "numeric". I think you should validate JSON-strings

Re: RFC: std.json sucessor

2014-08-26 Thread Sönke Ludwig via Digitalmars-d
Am 26.08.2014 03:31, schrieb Entusiastic user: Hi! Thanks for the effort you've put in this. I am having problems with building with LDC 0.14.0. DMD 2.066.0 seems to work fine (all unit tests pass). Do you have any ideas why? I've fixed all errors on DMD 2.065 now. Hopefully that should also

Re: RFC: std.json sucessor

2014-08-26 Thread via Digitalmars-d
On Tuesday, 26 August 2014 at 07:51:04 UTC, Sönke Ludwig wrote: That's true. So the ideal solution would be to *assume* UTF-8 when the input is char based and to *validate* if the input is "numeric". I think you should validate JSON-strings to be UTF-8 encoded even if you allow illegal unicod

Re: RFC: std.json sucessor

2014-08-26 Thread Sönke Ludwig via Digitalmars-d
Am 25.08.2014 23:53, schrieb "Ola Fosheim Grøstad" ": On Monday, 25 August 2014 at 21:27:42 UTC, Sönke Ludwig wrote: But why should UTF validation be the job of the lexer in the first place? Because you want to save time, it is faster to integrate validation? The most likely use scenario is to

Re: RFC: std.json sucessor

2014-08-26 Thread Ola Fosheim Gr via Digitalmars-d
On Tuesday, 26 August 2014 at 07:24:19 UTC, Don wrote: Processors from AMD have signalling NaN behaviour which is different from processors from Intel. And the situation is worst on most other architectures. It's a lost cause, I think. I disagree. AFAIK signaling NaN was standardized in IEEE

Re: RFC: std.json sucessor

2014-08-26 Thread Don via Digitalmars-d
On Monday, 25 August 2014 at 23:29:21 UTC, Walter Bright wrote: On 8/25/2014 4:15 PM, "Ola Fosheim Grøstad" " wrote: On Monday, 25 August 2014 at 21:24:11 UTC, Walter Bright wrote: I didn't know that. But recall I did implement it in DMC++, and it turned out to simply not be useful. I'd be surp

Re: RFC: std.json sucessor

2014-08-26 Thread Jacob Carlborg via Digitalmars-d
On 25/08/14 21:49, simendsjo wrote: So ldc can remove quite a substantial amount of code in some cases. It's because the latest release of LDC has the --gc-sections falg enabled by default. -- /Jacob Carlborg

Re: RFC: std.json sucessor

2014-08-25 Thread Entusiastic user via Digitalmars-d
... I am using Ubuntu 3.10 (Linux 3.11.0-15-generic x86_64). ... I meant Ubuntu 13.10 :D

Re: RFC: std.json sucessor

2014-08-25 Thread Entusiastic user via Digitalmars-d
Hi! Thanks for the effort you've put in this. I am having problems with building with LDC 0.14.0. DMD 2.066.0 seems to work fine (all unit tests pass). Do you have any ideas why? I am using Ubuntu 3.10 (Linux 3.11.0-15-generic x86_64). Master was at 6a9f8e62e456c3601fe8ff2e1fbb640f38793d08. $

Re: RFC: std.json sucessor

2014-08-25 Thread via Digitalmars-d
On Monday, 25 August 2014 at 23:24:43 UTC, Kiith-Sa wrote: D:YAML uses a similar approach, but with 8 bytes (plain ulong - portable) to detect how many ASCII chars are there before the first non-ASCII UTF-8 sequence, and it significantly improves performance (didn't keep any numbers unfortunat

Re: RFC: std.json sucessor

2014-08-25 Thread via Digitalmars-d
Btw, maybe it would be a good idea to take a look on the JSON that various browsers generates to see if there are any differences? Then one could tune optimizations to what is the most common coding, like this: 1. start parsing assuming "browser style restricted JSON" grammar. 2. on failure

Re: RFC: std.json sucessor

2014-08-25 Thread Walter Bright via Digitalmars-d
On 8/25/2014 4:15 PM, "Ola Fosheim Grøstad" " wrote: On Monday, 25 August 2014 at 21:24:11 UTC, Walter Bright wrote: I didn't know that. But recall I did implement it in DMC++, and it turned out to simply not be useful. I'd be surprised if the new C++ support for it does anything worthwhile. W

Re: RFC: std.json sucessor

2014-08-25 Thread Kiith-Sa via Digitalmars-d
On Monday, 25 August 2014 at 22:40:00 UTC, Ola Fosheim Grøstad wrote: On Monday, 25 August 2014 at 21:53:50 UTC, Ola Fosheim Grøstad wrote: I presume you can load 16 bytes and do BITWISE-AND on the MSB, then match against string-end and carefully use this to boost performance of simultanous UTF

Re: RFC: std.json sucessor

2014-08-25 Thread via Digitalmars-d
On Monday, 25 August 2014 at 21:24:11 UTC, Walter Bright wrote: I didn't know that. But recall I did implement it in DMC++, and it turned out to simply not be useful. I'd be surprised if the new C++ support for it does anything worthwhile. Well, one should initialize with signaling NaN. Then y

Re: RFC: std.json sucessor

2014-08-25 Thread via Digitalmars-d
On Monday, 25 August 2014 at 21:53:50 UTC, Ola Fosheim Grøstad wrote: I presume you can load 16 bytes and do BITWISE-AND on the MSB, then match against string-end and carefully use this to boost performance of simultanous UTF validation, escape-scanning, and string-end scan. A bit tricky, of co

Re: RFC: std.json sucessor

2014-08-25 Thread via Digitalmars-d
On Monday, 25 August 2014 at 21:27:42 UTC, Sönke Ludwig wrote: But why should UTF validation be the job of the lexer in the first place? Because you want to save time, it is faster to integrate validation? The most likely use scenario is to receive REST data over HTTP that needs validation.

Re: RFC: std.json sucessor

2014-08-25 Thread Walter Bright via Digitalmars-d
On 8/25/2014 12:49 PM, simendsjo wrote: I just happened to write a very small script yesterday and tested with the compilers (with dub --build=release). dmd: 2.8 mb gdc: 3.3 mb ldc 0.5 mb So ldc can remove quite a substantial amount of code in some cases. Speed optimizations are different.

Re: RFC: std.json sucessor

2014-08-25 Thread Walter Bright via Digitalmars-d
On 8/25/2014 1:35 PM, Sönke Ludwig wrote: BTW, JSON is *required* to be UTF encoded anyway as per RFC-7159, which is another argument for just letting the lexer assume valid UTF. I think that settles it.

Re: RFC: std.json sucessor

2014-08-25 Thread Sönke Ludwig via Digitalmars-d
Am 25.08.2014 22:51, schrieb "Ola Fosheim Grøstad" ": On Monday, 25 August 2014 at 20:35:32 UTC, Sönke Ludwig wrote: BTW, JSON is *required* to be UTF encoded anyway as per RFC-7159, which is another argument for just letting the lexer assume valid UTF. The lexer cannot assume valid UTF since

Re: RFC: std.json sucessor

2014-08-25 Thread Walter Bright via Digitalmars-d
On 8/25/2014 1:21 PM, "Ola Fosheim Grøstad" " wrote: On Monday, 25 August 2014 at 20:04:10 UTC, Ola Fosheim Grøstad wrote: I think supporting signaling NaN is important for correctness. It is defined in C++11: http://en.cppreference.com/w/cpp/types/numeric_limits/signaling_NaN I didn't kno

Re: RFC: std.json sucessor

2014-08-25 Thread via Digitalmars-d
On Monday, 25 August 2014 at 20:35:32 UTC, Sönke Ludwig wrote: BTW, JSON is *required* to be UTF encoded anyway as per RFC-7159, which is another argument for just letting the lexer assume valid UTF. The lexer cannot assume valid UTF since the client might be a rogue, but it can just bail out

Re: RFC: std.json sucessor

2014-08-25 Thread Sönke Ludwig via Digitalmars-d
Am 25.08.2014 22:21, schrieb Sönke Ludwig: that standard has no mention of infinity or NaN Sorry, to be precise, it has no suggestion of how to *handle* infinity or NaN.

Re: RFC: std.json sucessor

2014-08-25 Thread via Digitalmars-d
On Monday, 25 August 2014 at 20:21:01 UTC, Sönke Ludwig wrote: Well, of course it's based on that RFC, did you seriously think something else? I made no assumptions, just responded to what you wrote :-). It would be reasonable in the context of vibe.d to assume the ECMAScript spec. But I ge

Re: RFC: std.json sucessor

2014-08-25 Thread Sönke Ludwig via Digitalmars-d
Am 25.08.2014 21:50, schrieb "Ola Fosheim Grøstad" ": On Monday, 25 August 2014 at 19:38:05 UTC, Walter Bright wrote: The adaptation is to take arbitrary byte input in an unknown encoding and produce valid UTF. I agree. For a restful http service the encoding should be specified in the http h

Re: RFC: std.json sucessor

2014-08-25 Thread Sönke Ludwig via Digitalmars-d
- It makes more sense for ECMAScript to turn illegal values into null since it runs on the client. Like... node.js? Sorry, just kidding. I don't think it makes sense for clients to be less strict about such things, but I do agree with your assessment about being as strict as possible on the

Re: RFC: std.json sucessor

2014-08-25 Thread via Digitalmars-d
On Monday, 25 August 2014 at 20:04:10 UTC, Ola Fosheim Grøstad wrote: I think supporting signaling NaN is important for correctness. It is defined in C++11: http://en.cppreference.com/w/cpp/types/numeric_limits/signaling_NaN

Re: RFC: std.json sucessor

2014-08-25 Thread Sönke Ludwig via Digitalmars-d
Am 25.08.2014 17:46, schrieb "Ola Fosheim Grøstad" ": On Monday, 25 August 2014 at 15:34:29 UTC, Sönke Ludwig wrote: By default, floating-point special values are now output as 'null', according to the ECMA-script standard. Optionally, they will be emitted as 'NaN' and 'Infinity': ECMAScript p

Re: RFC: std.json sucessor

2014-08-25 Thread via Digitalmars-d
On Monday, 25 August 2014 at 19:42:03 UTC, Walter Bright wrote: Infinity. Mapping to max value would be a horrible bug. Yes… but then you are reading an illegal value that JSON does not support… For some reason D does not seem to support this aspect of IEEE754? I cannot find ".nans" listed

Re: RFC: std.json sucessor

2014-08-25 Thread via Digitalmars-d
On Monday, 25 August 2014 at 19:38:05 UTC, Walter Bright wrote: The adaptation is to take arbitrary byte input in an unknown encoding and produce valid UTF. I agree. For a restful http service the encoding should be specified in the http header and the input rejected if it isn't UTF compatib

Re: RFC: std.json sucessor

2014-08-25 Thread simendsjo via Digitalmars-d
On 08/25/2014 09:35 PM, Walter Bright wrote: > On 8/23/2014 6:32 PM, Brad Roberts via Digitalmars-d wrote: >>> I'm not convinced that using an adapter algorithm won't be just as fast. >> Consider your own talks on optimizing the existing dmd lexer. In >> those talks >> you've talked about the evil

Re: RFC: std.json sucessor

2014-08-25 Thread Walter Bright via Digitalmars-d
On 8/25/2014 6:23 AM, "Ola Fosheim Grøstad" " wrote: On Monday, 25 August 2014 at 13:07:08 UTC, Don wrote: practice. So a JSON parser should at least be able to lex them. ie this should be parsable: {"foo": NaN, "bar": Infinity, "baz": -Infinity} You should also put tests in for what happens

Re: RFC: std.json sucessor

2014-08-25 Thread Walter Bright via Digitalmars-d
On 8/23/2014 3:51 PM, Andrei Alexandrescu wrote: An adapter would solve the wrong problem here. There's nothing to adapt from and to. An adapter would be good if e.g. the stream uses UTF-16 or some Windows encoding. Bytes are the natural input for a json parser. The adaptation is to take arbit

Re: RFC: std.json sucessor

2014-08-25 Thread Walter Bright via Digitalmars-d
On 8/23/2014 6:32 PM, Brad Roberts via Digitalmars-d wrote: I'm not convinced that using an adapter algorithm won't be just as fast. Consider your own talks on optimizing the existing dmd lexer. In those talks you've talked about the evils of additional processing on every byte. That's what yo

Re: RFC: std.json sucessor

2014-08-25 Thread via Digitalmars-d
On Monday, 25 August 2014 at 15:46:12 UTC, Ola Fosheim Grøstad wrote: For a web server it would be most useful to get an exception since you risk ending up with web-clients not working with no logging. It is better to have an exception and log an error so the problem can be fixed. Let me expa

Re: RFC: std.json sucessor

2014-08-25 Thread via Digitalmars-d
On Monday, 25 August 2014 at 15:34:29 UTC, Sönke Ludwig wrote: By default, floating-point special values are now output as 'null', according to the ECMA-script standard. Optionally, they will be emitted as 'NaN' and 'Infinity': ECMAScript presumes double. I think one should base Phobos on lan

Re: RFC: std.json sucessor

2014-08-25 Thread Sönke Ludwig via Digitalmars-d
Am 25.08.2014 16:04, schrieb Sönke Ludwig: Am 25.08.2014 15:07, schrieb Don: On Thursday, 21 August 2014 at 22:35:18 UTC, Sönke Ludwig wrote: Following up on the recent "std.jgrandson" thread [1], I've picked up the work (a lot earlier than anticipated) and finished a first version of a loose b

Re: RFC: std.json sucessor

2014-08-25 Thread Sönke Ludwig via Digitalmars-d
Am 25.08.2014 15:07, schrieb Don: On Thursday, 21 August 2014 at 22:35:18 UTC, Sönke Ludwig wrote: Following up on the recent "std.jgrandson" thread [1], I've picked up the work (a lot earlier than anticipated) and finished a first version of a loose blend of said std.jgrandson, vibe.data.json a

Re: RFC: std.json sucessor

2014-08-25 Thread Sönke Ludwig via Digitalmars-d
Am 25.08.2014 14:12, schrieb "Ola Fosheim Grøstad" ": On Monday, 25 August 2014 at 11:30:15 UTC, Sönke Ludwig wrote: I've added support (compile time option [1]) for long and BigInt in the lexer (and parser), see [2]. JSONValue currently still only stores double for numbers. It can be very use

Re: RFC: std.json sucessor

2014-08-25 Thread via Digitalmars-d
On Monday, 25 August 2014 at 13:07:08 UTC, Don wrote: practice. So a JSON parser should at least be able to lex them. ie this should be parsable: {"foo": NaN, "bar": Infinity, "baz": -Infinity} You should also put tests in for what happens when you pass NaN or infinity to toJSON. It shouldn't

Re: RFC: std.json sucessor

2014-08-25 Thread Don via Digitalmars-d
On Thursday, 21 August 2014 at 22:35:18 UTC, Sönke Ludwig wrote: Following up on the recent "std.jgrandson" thread [1], I've picked up the work (a lot earlier than anticipated) and finished a first version of a loose blend of said std.jgrandson, vibe.data.json and some changes that I had plann

Re: RFC: std.json sucessor

2014-08-25 Thread via Digitalmars-d
On Monday, 25 August 2014 at 11:30:15 UTC, Sönke Ludwig wrote: I've added support (compile time option [1]) for long and BigInt in the lexer (and parser), see [2]. JSONValue currently still only stores double for numbers. It can be very useful to have a base 10 exponent representation in cert

Re: RFC: std.json sucessor

2014-08-25 Thread Sönke Ludwig via Digitalmars-d
I've added support (compile time option [1]) for long and BigInt in the lexer (and parser), see [2]. JSONValue currently still only stores double for numbers. There are two options for extending JSONValue: 1. Add long and BigInt to the set of supported types for JSONValue. This preserves all f

Re: RFC: std.json sucessor

2014-08-23 Thread Brad Roberts via Digitalmars-d
On 8/23/2014 3:20 PM, Walter Bright via Digitalmars-d wrote: On 8/23/2014 12:00 PM, Brad Roberts via Digitalmars-d wrote: On 8/23/2014 10:46 AM, Walter Bright via Digitalmars-d wrote: I feel that non-UTF encodings should be handled by adapter algorithms, not embedded into the JSON lexer, so yes

Re: RFC: std.json sucessor

2014-08-23 Thread Andrei Alexandrescu via Digitalmars-d
On 8/23/14, 3:24 PM, Walter Bright wrote: On 8/23/2014 2:36 PM, Andrei Alexandrescu wrote: 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 validati

Re: RFC: std.json sucessor

2014-08-23 Thread Walter Bright via Digitalmars-d
On 8/23/2014 2:36 PM, Andrei Alexandrescu wrote: 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,

Re: RFC: std.json sucessor

2014-08-23 Thread Walter Bright via Digitalmars-d
On 8/23/2014 12:00 PM, Brad Roberts via Digitalmars-d wrote: On 8/23/2014 10:46 AM, Walter Bright via Digitalmars-d wrote: I feel that non-UTF encodings should be handled by adapter algorithms, not embedded into the JSON lexer, so yes, I'd drop that. For performance purposes, determining encod

Re: RFC: std.json sucessor

2014-08-23 Thread Andrei Alexandrescu via Digitalmars-d
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 m

Re: RFC: std.json sucessor

2014-08-23 Thread deadalnix via Digitalmars-d
On Saturday, 23 August 2014 at 09:22:01 UTC, Sönke Ludwig wrote: Main issues of using opDispatch: - Prone to bugs where a normal field/method of the JSONValue struct is accessed instead of a JSON field - On top of that the var.field syntax gives the wrong impression that you are working with

Re: RFC: std.json sucessor

2014-08-23 Thread via Digitalmars-d
Some baselines for performance: https://github.com/mloskot/json_benchmark http://chadaustin.me/2013/01/json-parser-benchmarking/

Re: RFC: std.json sucessor

2014-08-23 Thread via Digitalmars-d
On Saturday, 23 August 2014 at 19:01:13 UTC, Brad Roberts via Digitalmars-d wrote: original string is ascii or utf-8 or other. The cost during lexing is essentially zero. I am not so sure when it comes to SIMD lexing. I think the specified behaviour should be done in a way which encourage lat

Re: RFC: std.json sucessor

2014-08-23 Thread Brad Roberts via Digitalmars-d
On 8/23/2014 10:46 AM, Walter Bright via Digitalmars-d 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 basica

Re: RFC: std.json sucessor

2014-08-23 Thread Sönke Ludwig via Digitalmars-d
Am 23.08.2014 20:31, schrieb "Marc Schütz" ": On Saturday, 23 August 2014 at 17:32:01 UTC, Sönke Ludwig wrote: Am 23.08.2014 19:25, schrieb "Marc Schütz" ": On Saturday, 23 August 2014 at 16:49:23 UTC, Sönke Ludwig wrote: Am 22.08.2014 21:00, schrieb "Marc Schütz" ": On Friday, 22 August 2014

Re: RFC: std.json sucessor

2014-08-23 Thread via Digitalmars-d
On Saturday, 23 August 2014 at 17:32:01 UTC, Sönke Ludwig wrote: Am 23.08.2014 19:25, schrieb "Marc Schütz" ": On Saturday, 23 August 2014 at 16:49:23 UTC, Sönke Ludwig wrote: Am 22.08.2014 21:00, schrieb "Marc Schütz" ": On Friday, 22 August 2014 at 18:08:34 UTC, Sönke Ludwig wrote: Am 22.08.

Re: RFC: std.json sucessor

2014-08-23 Thread Walter Bright via Digitalmars-d
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

  1   2   >