August 06, 2014
"Jacob Carlborg"  wrote in message news:lrsrek$19mf$1@digitalmars.com...

> > Chances are tying it to a future
> > generic serialization library is going to make it take longer.
>
> Yeah, that's the problem. But where do you draw the line. Should arrays of structs be supported?

Yes.  Allow T, where T is any of

int, float, long, etc
bool
struct { T... }
T[string]
T[]

Sure, you _can_ make a struct containing an array that contains itself, but you probably won't. 

August 06, 2014
On Tuesday, 5 August 2014 at 18:11:21 UTC, H. S. Teoh via Digitalmars-d wrote:
> On Tue, Aug 05, 2014 at 10:58:08AM -0700, Andrei Alexandrescu via Digitalmars-d wrote:
>> On 8/5/14, 10:48 AM, Sean Kelly wrote:
> [...]

> Would it make sense to wrap a JSON number in an opaque type that
> implicitly casts to the target built-in type?

IMO we should store original json number value as string and then try to convert to what user asks for.

As said, it could be a big int, or a big floating point value without any limit.
August 06, 2014
On 2014-08-06 13:36, Daniel Murphy wrote:

> Yes.  Allow T, where T is any of
>
> int, float, long, etc
> bool
> struct { T... }
> T[string]
> T[]

BTW, why not classes? It's basically the same implementation as for structs.

-- 
/Jacob Carlborg
August 06, 2014
"Jacob Carlborg"  wrote in message news:lrtf8l$22d3$1@digitalmars.com...

> BTW, why not classes? It's basically the same implementation as for structs.

I guess I've just never needed to do it with classes.  A lot of the time when I use classes I use inheritance, and this simple translation doesn't work out so will then... 

August 06, 2014
On Wednesday, 6 August 2014 at 15:28:06 UTC, Daniel Murphy wrote:
> "Jacob Carlborg"  wrote in message news:lrtf8l$22d3$1@digitalmars.com...
>
>> BTW, why not classes? It's basically the same implementation as for structs.
>
> I guess I've just never needed to do it with classes.  A lot of the time when I use classes I use inheritance, and this simple translation doesn't work out so will then...

We could do something like Jackson. I wouldn't want it as the primary interface for a JSON package, but for serializing classes it's a pretty easy design to work with from a user perspective.
1 2 3 4 5 6 7 8
Next ›   Last »