Re: std.data.json formal review

2015-07-30 Thread Suliman via Digitalmars-d
If this implementation will be merged with phobos will vibed migrate to it, or it would two similar libs?

Re: std.data.json formal review

2015-07-29 Thread H. S. Teoh via Digitalmars-d
On Wed, Jul 29, 2015 at 03:22:05PM +, Don via Digitalmars-d wrote: On Tuesday, 28 July 2015 at 22:29:01 UTC, Walter Bright wrote: [...] The possible JSON values are: string number object (associative arrays) array true false null Since these are D

Re: std.data.json formal review

2015-07-29 Thread Laeeth Isharc via Digitalmars-d
Here's a thought: what about always storing JSON numbers as strings (albeit tagged with the number type, to differentiate them from actual strings in the input), and the user specifies what type to convert it to? The default type can be something handy, like int, but the user has the option

Re: std.data.json formal review

2015-07-29 Thread sigod via Digitalmars-d
On Wednesday, 29 July 2015 at 17:04:33 UTC, Laeeth Isharc wrote: [...] Some JSON files can be quite large... For example, I have a compressed 175 Gig of Reddit comments (one file per month) I would like to work with using D, and time + memory demands = money. Wouldn't it be a pain not to

Re: std.data.json formal review

2015-07-29 Thread Sönke Ludwig via Digitalmars-d
Am 29.07.2015 um 17:22 schrieb Don: Related to this: it should not be importing std.bigint. Note that if std.bigint were fully implemented, it would be very heavyweight (optimal multiplication of enormous integers involves fast fourier transforms and all kinds of odd stuff, that's really

Re: std.data.json formal review

2015-07-29 Thread Sönke Ludwig via Digitalmars-d
Am 29.07.2015 um 18:47 schrieb H. S. Teoh via Digitalmars-d: On Wed, Jul 29, 2015 at 03:22:05PM +, Don via Digitalmars-d wrote: On Tuesday, 28 July 2015 at 22:29:01 UTC, Walter Bright wrote: [...] The possible JSON values are: string number object (associative arrays)

Re: std.data.json formal review

2015-07-29 Thread Don via Digitalmars-d
On Tuesday, 28 July 2015 at 22:29:01 UTC, Walter Bright wrote: On 7/28/2015 7:07 AM, Atila Neves wrote: Start of the two week process, folks. Thank you very much, Sönke, for taking this on. Thank you, Atila, for taking on the thankless job of being review manager. Just looking at the

Re: std.data.json formal review

2015-07-29 Thread Sönke Ludwig via Digitalmars-d
Am 29.07.2015 um 20:44 schrieb Walter Bright: On 7/29/2015 1:37 AM, Sönke Ludwig wrote: There are actually even four levels: 1. Range of characters 2. Range of tokens 3. Range of nodes 4. DOM value What's the need for users to see a token stream? I don't know what the DOM value is - is that

Re: std.data.json formal review

2015-07-29 Thread Walter Bright via Digitalmars-d
On 7/29/2015 1:37 AM, Sönke Ludwig wrote: There are actually even four levels: 1. Range of characters 2. Range of tokens 3. Range of nodes 4. DOM value What's the need for users to see a token stream? I don't know what the DOM value is - is that just JSON as an ast? Having a special case

Re: std.data.json formal review

2015-07-29 Thread matovitch via Digitalmars-d
Hi Sonke, Great to see your module moving towards phobos inclusion (I have not been following the latest progress of D sadly :() ! Just a small remark from the documentation example. Maybe it would be better to replace : value.toJSONString!true() by value.toJSONString!prettify()

Re: std.data.json formal review

2015-07-29 Thread Walter Bright via Digitalmars-d
On 7/29/2015 3:10 AM, Jacob Carlborg wrote: On 2015-07-29 06:57, Walter Bright wrote: A JSON value is a tagged union of the various types. But in most cases I think there will be one root node, of type object. An object is a collection of other Values. In that case it would be range

Re: std.data.json formal review

2015-07-29 Thread Sönke Ludwig via Digitalmars-d
Am 29.07.2015 um 20:21 schrieb matovitch: Hi Sonke, Great to see your module moving towards phobos inclusion (I have not been following the latest progress of D sadly :() ! Just a small remark from the documentation example. Maybe it would be better to replace : value.toJSONString!true()

Re: std.data.json formal review

2015-07-29 Thread Walter Bright via Digitalmars-d
On 7/28/2015 10:49 PM, H. S. Teoh via Digitalmars-d wrote: How does a linear range of nodes convey a nested structure? You'd need to add a special node type, 'end'. So an array [1,true] would look like: array number true end

Re: std.data.json formal review

2015-07-29 Thread Jacob Carlborg via Digitalmars-d
On 2015-07-29 20:33, Walter Bright wrote: On 7/29/2015 3:10 AM, Jacob Carlborg wrote: But in most cases I think there will be one root node, of type object. An object is a collection of other Values. In that case it would be range with only one element? How does that help? I don't

Re: std.data.json formal review

2015-07-29 Thread Piotr Szturmaj via Digitalmars-d
W dniu 2015-07-29 o 00:37, H. S. Teoh via Digitalmars-d pisze: On Tue, Jul 28, 2015 at 03:29:02PM -0700, Walter Bright via Digitalmars-d wrote: [...] 3. Stepping back a bit, when I think of parsing JSON data, I think: auto ast = inputrange.toJSON(); where toJSON() accepts an input range

Re: std.data.json formal review

2015-07-29 Thread Walter Bright via Digitalmars-d
On 7/29/2015 11:51 AM, Jacob Carlborg wrote: I guess I'm finding it difficult to picture a JSON structure as a range. How would the following JSON be returned as a range? { a: 1, b: [2, 3], c: { d: 4 } } It if was returned as a range of nodes, it would be: Object, string,

Re: std.data.json formal review

2015-07-29 Thread Walter Bright via Digitalmars-d
On 7/29/2015 1:41 PM, Sönke Ludwig wrote: The token level is useful for reasoning about the text representation. It could be used for example to implement syntax highlighting, or for using the location information to mark errors in the source code. Ok, I see your point. The question then

Re: std.data.json formal review

2015-07-29 Thread Walter Bright via Digitalmars-d
On 7/29/2015 1:18 AM, Sönke Ludwig wrote: Am 29.07.2015 um 00:29 schrieb Walter Bright: 1. Not sure that 'JSON' needs to be embedded in the public names. 'parseJSONStream' should just be 'parseStream', etc. Name disambiguation, if needed, should be ably taken care of by a number of D features

Re: std.data.json formal review

2015-07-29 Thread Sönke Ludwig via Digitalmars-d
Am 29.07.2015 um 07:43 schrieb Walter Bright: On 7/28/2015 3:55 PM, Walter Bright wrote: OTOH, some people might want the option of parser-driven data processing instead (e.g. the JSON data is very large and we don't want to store the whole thing in memory at once). That is a good point. So

Re: std.data.json formal review

2015-07-29 Thread Sönke Ludwig via Digitalmars-d
Am 29.07.2015 um 09:46 schrieb Andrea Fontana: On Tuesday, 28 July 2015 at 14:07:19 UTC, Atila Neves wrote: Start of the two week process, folks. Code: https://github.com/s-ludwig/std_data_json Docs: http://s-ludwig.github.io/std_data_json/ Atila Why don't do a shortcut like:

Re: std.data.json formal review

2015-07-29 Thread Sönke Ludwig via Digitalmars-d
Am 29.07.2015 um 00:37 schrieb H. S. Teoh via Digitalmars-d: On Tue, Jul 28, 2015 at 03:29:02PM -0700, Walter Bright via Digitalmars-d wrote: [...] 3. Stepping back a bit, when I think of parsing JSON data, I think: auto ast = inputrange.toJSON(); where toJSON() accepts an input range

Re: std.data.json formal review

2015-07-29 Thread Andrea Fontana via Digitalmars-d
On Tuesday, 28 July 2015 at 14:07:19 UTC, Atila Neves wrote: Start of the two week process, folks. Code: https://github.com/s-ludwig/std_data_json Docs: http://s-ludwig.github.io/std_data_json/ Atila Why don't do a shortcut like: jv.opt(/this/is/a/path) ? I use it in my json/bson binding.

Re: std.data.json formal review

2015-07-29 Thread Sönke Ludwig via Digitalmars-d
Am 29.07.2015 um 00:29 schrieb Walter Bright: On 7/28/2015 7:07 AM, Atila Neves wrote: Start of the two week process, folks. Thank you very much, Sönke, for taking this on. Thank you, Atila, for taking on the thankless job of being review manager. Just looking at the documentation only, some

Re: std.data.json formal review

2015-07-29 Thread Jacob Carlborg via Digitalmars-d
On 2015-07-29 06:57, Walter Bright wrote: A JSON value is a tagged union of the various types. But in most cases I think there will be one root node, of type object. In that case it would be range with only one element? How does that help? -- /Jacob Carlborg

Re: std.data.json formal review

2015-07-29 Thread Sönke Ludwig via Digitalmars-d
Am 29.07.2015 um 12:10 schrieb Jacob Carlborg: On 2015-07-29 06:57, Walter Bright wrote: A JSON value is a tagged union of the various types. But in most cases I think there will be one root node, of type object. In that case it would be range with only one element? How does that help? I

Re: std.data.json formal review

2015-07-29 Thread Andrea Fontana via Digitalmars-d
On Wednesday, 29 July 2015 at 08:55:20 UTC, Sönke Ludwig wrote: That would be another possibility. What do you think about the opt(jv).foo.bar[12].baz alternative? One advantage is that it could work without parsing a string and the implications thereof (error handling?). I implemented it

std.data.json formal review

2015-07-29 Thread Atila Neves via Digitalmars-d-announce
http://forum.dlang.org/thread/nbuhouhimowvcqssv...@forum.dlang.org

Re: std.data.json formal review

2015-07-28 Thread Walter Bright via Digitalmars-d
On 7/28/2015 7:07 AM, Atila Neves wrote: Start of the two week process, folks. Thank you very much, Sönke, for taking this on. Thank you, Atila, for taking on the thankless job of being review manager. Just looking at the documentation only, some general notes: 1. Not sure that 'JSON'

Re: std.data.json formal review

2015-07-28 Thread H. S. Teoh via Digitalmars-d
On Tue, Jul 28, 2015 at 03:55:22PM -0700, Walter Bright via Digitalmars-d wrote: On 7/28/2015 3:37 PM, H. S. Teoh via Digitalmars-d wrote: On Tue, Jul 28, 2015 at 03:29:02PM -0700, Walter Bright via Digitalmars-d wrote: Ideally, I'd say hook it up to std.conv.to for maximum flexibility. Then

Re: std.data.json formal review

2015-07-28 Thread Walter Bright via Digitalmars-d
On 7/28/2015 3:37 PM, H. S. Teoh via Digitalmars-d wrote: On Tue, Jul 28, 2015 at 03:29:02PM -0700, Walter Bright via Digitalmars-d wrote: Ideally, I'd say hook it up to std.conv.to for maximum flexibility. Then you can just use to() to convert between a JSON container and the value that it

Re: std.data.json formal review

2015-07-28 Thread Walter Bright via Digitalmars-d
A speed optimization, since JSON parsing speed is critical: If the parser is able to use slices of its input, store numbers as slices. Only convert them to numbers lazily, as the numeric conversion can take significant time.

Re: std.data.json formal review

2015-07-28 Thread Brad Anderson via Digitalmars-d
On Tuesday, 28 July 2015 at 23:16:34 UTC, Walter Bright wrote: A speed optimization, since JSON parsing speed is critical: If the parser is able to use slices of its input, store numbers as slices. Only convert them to numbers lazily, as the numeric conversion can take significant time.

Re: std.data.json formal review

2015-07-28 Thread Etienne Cimon via Digitalmars-d
On Tuesday, 28 July 2015 at 18:45:51 UTC, Sönke Ludwig wrote: Am 28.07.2015 um 17:19 schrieb Etienne Cimon: On Tuesday, 28 July 2015 at 14:07:19 UTC, Atila Neves wrote: Start of the two week process, folks. Code: https://github.com/s-ludwig/std_data_json Docs:

std.data.json formal review

2015-07-28 Thread Atila Neves via Digitalmars-d
Start of the two week process, folks. Code: https://github.com/s-ludwig/std_data_json Docs: http://s-ludwig.github.io/std_data_json/ Atila

Re: std.data.json formal review

2015-07-28 Thread Rikki Cattermole via Digitalmars-d
On 29/07/2015 4:25 a.m., Mathias Lang via Digitalmars-d wrote: 2015-07-28 17:55 GMT+02:00 Brad Anderson via Digitalmars-d digitalmars-d@puremagic.com mailto:digitalmars-d@puremagic.com: Unless there is some sort of proof that it will work with allocators. I have used

Re: std.data.json formal review

2015-07-28 Thread Rikki Cattermole via Digitalmars-d
On 29/07/2015 4:23 a.m., Etienne Cimon wrote: On Tuesday, 28 July 2015 at 15:55:04 UTC, Brad Anderson wrote: On Tuesday, 28 July 2015 at 15:07:46 UTC, Rikki Cattermole wrote: On 29/07/2015 2:07 a.m., Atila Neves wrote: Start of the two week process, folks. Code:

Re: std.data.json formal review

2015-07-28 Thread Rikki Cattermole via Digitalmars-d
On 29/07/2015 2:07 a.m., Atila Neves wrote: Start of the two week process, folks. Code: https://github.com/s-ludwig/std_data_json Docs: http://s-ludwig.github.io/std_data_json/ Atila Right now, my view is no. Unless there is some sort of proof that it will work with allocators. I have used

Re: std.data.json formal review

2015-07-28 Thread Brad Anderson via Digitalmars-d
On Tuesday, 28 July 2015 at 15:07:46 UTC, Rikki Cattermole wrote: On 29/07/2015 2:07 a.m., Atila Neves wrote: Start of the two week process, folks. Code: https://github.com/s-ludwig/std_data_json Docs: http://s-ludwig.github.io/std_data_json/ Atila Right now, my view is no. Just a

Re: std.data.json formal review

2015-07-28 Thread Etienne Cimon via Digitalmars-d
On Tuesday, 28 July 2015 at 15:07:46 UTC, Rikki Cattermole wrote: On 29/07/2015 2:07 a.m., Atila Neves wrote: Start of the two week process, folks. Code: https://github.com/s-ludwig/std_data_json Docs: http://s-ludwig.github.io/std_data_json/ Atila Right now, my view is no. Unless there is

Re: std.data.json formal review

2015-07-28 Thread Etienne Cimon via Digitalmars-d
On Tuesday, 28 July 2015 at 14:07:19 UTC, Atila Neves wrote: Start of the two week process, folks. Code: https://github.com/s-ludwig/std_data_json Docs: http://s-ludwig.github.io/std_data_json/ Atila This is cool:

Re: std.data.json formal review

2015-07-28 Thread Walter Bright via Digitalmars-d
On 7/28/2015 3:55 PM, Walter Bright wrote: OTOH, some people might want the option of parser-driven data processing instead (e.g. the JSON data is very large and we don't want to store the whole thing in memory at once). That is a good point. So it appears that JSON can be in one of 3 useful

Re: std.data.json formal review

2015-07-28 Thread H. S. Teoh via Digitalmars-d
On Tue, Jul 28, 2015 at 10:43:20PM -0700, Walter Bright via Digitalmars-d wrote: On 7/28/2015 3:55 PM, Walter Bright wrote: OTOH, some people might want the option of parser-driven data processing instead (e.g. the JSON data is very large and we don't want to store the whole thing in memory at

Re: std.data.json formal review

2015-07-28 Thread Walter Bright via Digitalmars-d
On 7/28/2015 5:15 PM, H. S. Teoh via Digitalmars-d wrote: Probably simply returning an InputRange of JSON values. But how would you capture the nesting substructures? A JSON value is a tagged union of the various types. ??! Surely you have heard of the non-allocating overload of toString?

Re: std.data.json formal review

2015-07-28 Thread Rikki Cattermole via Digitalmars-d
On 29/07/2015 4:43 a.m., Sönke Ludwig wrote: Am 28.07.2015 um 17:07 schrieb Rikki Cattermole: I have used the code from vibe.d days so its not an issue of how well it works nor nit picky. You should still have a closer look, as it isn't very similar to the vibe.d code at all, but a rather

Re: std.data.json formal review

2015-07-28 Thread Rikki Cattermole via Digitalmars-d
On 29/07/2015 4:41 a.m., Sönke Ludwig wrote: Am 28.07.2015 um 17:07 schrieb Rikki Cattermole: On 29/07/2015 2:07 a.m., Atila Neves wrote: Start of the two week process, folks. Code: https://github.com/s-ludwig/std_data_json Docs: http://s-ludwig.github.io/std_data_json/ Atila Right now, my

Re: std.data.json formal review

2015-07-28 Thread Sönke Ludwig via Digitalmars-d
Am 28.07.2015 um 17:07 schrieb Rikki Cattermole: On 29/07/2015 2:07 a.m., Atila Neves wrote: Start of the two week process, folks. Code: https://github.com/s-ludwig/std_data_json Docs: http://s-ludwig.github.io/std_data_json/ Atila Right now, my view is no. Unless there is some sort of

Re: std.data.json formal review

2015-07-28 Thread Mathias Lang via Digitalmars-d
2015-07-28 17:55 GMT+02:00 Brad Anderson via Digitalmars-d digitalmars-d@puremagic.com: Unless there is some sort of proof that it will work with allocators. I have used the code from vibe.d days so its not an issue of how well it works nor nit picky. Just can I pass it an allocator

Re: std.data.json formal review

2015-07-28 Thread Sönke Ludwig via Digitalmars-d
Am 28.07.2015 um 17:07 schrieb Rikki Cattermole: I have used the code from vibe.d days so its not an issue of how well it works nor nit picky. You should still have a closer look, as it isn't very similar to the vibe.d code at all, but a rather radical evolution.

Re: std.data.json formal review

2015-07-28 Thread Etienne Cimon via Digitalmars-d
On Tuesday, 28 July 2015 at 15:55:04 UTC, Brad Anderson wrote: On Tuesday, 28 July 2015 at 15:07:46 UTC, Rikki Cattermole wrote: On 29/07/2015 2:07 a.m., Atila Neves wrote: Start of the two week process, folks. Code: https://github.com/s-ludwig/std_data_json Docs:

Re: std.data.json formal review

2015-07-28 Thread Sönke Ludwig via Digitalmars-d
Am 28.07.2015 um 16:07 schrieb Atila Neves: Start of the two week process, folks. Code: https://github.com/s-ludwig/std_data_json Docs: http://s-ludwig.github.io/std_data_json/ Atila Thanks for making it happen! Can you also post a quick link to this thread in D.announce?

Re: std.data.json formal review

2015-07-28 Thread Sönke Ludwig via Digitalmars-d
Am 28.07.2015 um 17:19 schrieb Etienne Cimon: On Tuesday, 28 July 2015 at 14:07:19 UTC, Atila Neves wrote: Start of the two week process, folks. Code: https://github.com/s-ludwig/std_data_json Docs: http://s-ludwig.github.io/std_data_json/ Atila This is cool:

Re: std.data.json formal review

2015-07-28 Thread Brad Anderson via Digitalmars-d
On Tuesday, 28 July 2015 at 18:45:51 UTC, Sönke Ludwig wrote: An idea might be to support something like this: json_value.opt.foo.bar[2].baz or opt(json_value).foo.bar[2].baz opt (name is debatable) would return a wrapper struct around the JSONValue that supports opDispatch/opIndex and

Re: std.data.json formal review

2015-07-28 Thread H. S. Teoh via Digitalmars-d
On Tue, Jul 28, 2015 at 03:29:02PM -0700, Walter Bright via Digitalmars-d wrote: [...] 3. Stepping back a bit, when I think of parsing JSON data, I think: auto ast = inputrange.toJSON(); where toJSON() accepts an input range and produces a container, the ast. The ast is just a JSON

Re: std.data.json formal review

2015-07-28 Thread Walter Bright via Digitalmars-d
On 7/28/2015 4:24 PM, Brad Anderson wrote: On Tuesday, 28 July 2015 at 23:16:34 UTC, Walter Bright wrote: A speed optimization, since JSON parsing speed is critical: If the parser is able to use slices of its input, store numbers as slices. Only convert them to numbers lazily, as the numeric

<    1   2   3