std.json

2012-03-25 Thread AaronP
Could I get a hello, world example of parsing json? The docs look 
simple enough, but I could still use an example.


Re: std.json

2012-03-25 Thread AaronP

On 03/25/2012 12:50 PM, Andrea Fontana wrote:

Hope it's clear...


import std.json;
import std.stdio;

void main(string args[])
{
JSONValue json = parseJSON(qEOS
{
key :
{
subkey1 : str_val,
subkey2 : [1,2,3],
subkey3 : 3.1415
}
}
EOS);
writeln(json.object[key].object[subkey1].str);
writeln(json.object[key].object[subkey2].array[1].integer);
writeln(json.object[key].object[subkey3].type == JSON_TYPE.FLOAT);
}


On Sunday, 25 March 2012 at 15:26:31 UTC, AaronP wrote:

Could I get a hello, world example of parsing json? The docs look
simple enough, but I could still use an example.




Ah. That's perfect, thanks. :)


Re: A GUI library to begin with

2012-02-08 Thread AaronP

On 02/07/2012 09:55 PM, Mr. Anonymous wrote:

Hello,

I want to start playing with D, and I'm looking at a GUI library to
begin with.
 From what I see here:
http://www.prowiki.org/wiki4d/wiki.cgi?GuiLibraries
I have four choices:
GtkD, DWT, DFL, DGui.

Has anyone tried these? Any suggestions?
What is the status of DWT? What's the difference between DFL and DGui?
Why does GTK suck (I read that a couple of times).

Thanks.


I wrote a small utility in gtkd and it seemed good enough. I'm not sure 
how it'd hold up for larger projects, but the toolkit it's built on 
(GTK) is quite mature. I don't think it sucks at all, just that GUI 
programming in C sucks in general. :P


Re: A GUI library to begin with

2012-02-08 Thread AaronP

On 02/08/2012 09:24 AM, Jesse Phillips wrote:

I think GtkD is stated to suck because it isn't native to Windows or
Mac, both in look and availability.



Hmm, perhaps. Incidentally, it looks great on Linux! :P


Re: Bug or feature? std.c.stdlib.exit() breaks RAII

2011-12-29 Thread AaronP

On 12/29/2011 12:43 PM, Ashish Myles wrote:

On Thu, Dec 29, 2011 at 1:26 PM, Andrej Mitrovic
andrej.mitrov...@gmail.com  wrote:

Probably the easiest thing to do is to throw a custom exception and
catch it somewhere in main() to return your status code. Unlike
exit(), throwing will take care of RAII stuff.


Thanks, Andrej. That option had occurred to me, but I figured that
shouldn't be the way to do things given that most other languages have
a native exit function. Given that this code transformation isn't
particularly difficult (put main in a try/catch, have a custom
exception storing exit code, return the exit code in the catch block),
would it be reasonable to do a feature request for a
D-language-supported exit()?


Yeah, really. I'd been using the C exit() as well. Seems like a pretty 
fundamental feature. :O