Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
October 30, 2020 Why is vibe.d json serializer/deserializer so complex? | ||||
---|---|---|---|---|
| ||||
I was looking to report an enhancement request to vibe.data.json (filed here: https://github.com/vibe-d/vibe.d/issues/2490), and I started looking at the serialization code for vibe. It's really really complicated, and I'm just wondering if this is a case of overengineering, or if there's a logic behind making this so complicated. My iopipejson serializer is super simple comparatively. Is there a benefit to having all the complexity? I know they support both json and bson, but I cannot follow the code very well, and I'm not sure what happens where, and which types are responsible for what. -Steve |
October 31, 2020 Re: Why is vibe.d json serializer/deserializer so complex? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | On 10/30/20 1:56 PM, Steven Schveighoffer wrote:
> I was looking to report an enhancement request to vibe.data.json (filed here: https://github.com/vibe-d/vibe.d/issues/2490), and I started looking at the serialization code for vibe. It's really really complicated, and I'm just wondering if this is a case of overengineering, or if there's a logic behind making this so complicated. My iopipejson serializer is super simple comparatively.
>
> Is there a benefit to having all the complexity? I know they support both json and bson, but I cannot follow the code very well, and I'm not sure what happens where, and which types are responsible for what.
>
> -Steve
So I've been meaning to ask this as I have been learning Rust off-and-on recently for web development, and was impressed by the traits functionality. In particular, with traits and some agreed upon API, many packages are interchangeable in terms of various functionalities, including JSON serialization/deserialization.
What would be the nearest analog facility in D -- supposing we could agree on a standard API -- to facilitate pluggable serializers?
I am a big fan of asdf (and Steve, haven't tried iopipejson yet, but will do). It would be nice to not rewrite code to try a different serializer, and Rust is really neat in this regard.
|
October 31, 2020 Re: Why is vibe.d json serializer/deserializer so complex? | ||||
---|---|---|---|---|
| ||||
Posted in reply to James Blachly | On Saturday, 31 October 2020 at 22:42:20 UTC, James Blachly wrote:
> be the nearest analog facility in D -- supposing we could agree on a standard API -- to facilitate pluggable serializers?
interfaces?
could even be informal interfaces where you just use the same function names
so something in the middle, like how isInputRange works.
|
November 01, 2020 Re: Why is vibe.d json serializer/deserializer so complex? | ||||
---|---|---|---|---|
| ||||
Posted in reply to James Blachly | On Saturday, 31 October 2020 at 22:42:20 UTC, James Blachly wrote:
> On 10/30/20 1:56 PM, Steven Schveighoffer wrote:
>> [...]
>
> So I've been meaning to ask this as I have been learning Rust off-and-on recently for web development, and was impressed by the traits functionality. In particular, with traits and some agreed upon API, many packages are interchangeable in terms of various functionalities, including JSON serialization/deserialization.
>
> What would be the nearest analog facility in D -- supposing we could agree on a standard API -- to facilitate pluggable serializers?
>
> I am a big fan of asdf (and Steve, haven't tried iopipejson yet, but will do). It would be nice to not rewrite code to try a different serializer, and Rust is really neat in this regard.
An interface defined in the standard library
|
November 01, 2020 Re: Why is vibe.d json serializer/deserializer so complex? | ||||
---|---|---|---|---|
| ||||
Posted in reply to James Blachly | On Saturday, 31 October 2020 at 22:42:20 UTC, James Blachly wrote: > So I've been meaning to ask this as I have been learning Rust off-and-on recently for web development, and was impressed by the traits functionality. In particular, with traits and some agreed upon API, many packages are interchangeable in terms of various functionalities, including JSON serialization/deserialization. > > What would be the nearest analog facility in D -- supposing we could agree on a standard API -- to facilitate pluggable serializers? > > I am a big fan of asdf (and Steve, haven't tried iopipejson yet, but will do). It would be nice to not rewrite code to try a different serializer, and Rust is really neat in this regard. Well I was putting this together, but didn't want to attempt submission until I felt I would be able to put in the time for the review process https://github.com/JesseKPhillips/DIPs/blob/serialize/attribute/DIPs/1NNN-jkp.md |
November 01, 2020 Re: Why is vibe.d json serializer/deserializer so complex? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jesse Phillips | On 10/31/20 8:28 PM, Jesse Phillips wrote:
> Well I was putting this together, but didn't want to attempt submission until I felt I would be able to put in the time for the review process
>
> https://github.com/JesseKPhillips/DIPs/blob/serialize/attribute/DIPs/1NNN-jkp.md
Bravo! An idea whose time has come.
I will follow this with interest.
May take some horse-trading, I imagine.
|
Copyright © 1999-2021 by the D Language Foundation