On Wed, 15 Dec 2010 12:27:48 +0200, Andrej Mitrovic
<[email protected]> wrote:
On 12/14/10, Vladimir Panteleev <[email protected]> wrote:
if (resource == "/getfoo")
{
struct FooResult { int n; string s; }
return toJSON(FooResult(42, "bar")); // {"n":42,"s":"bar"}
}
Funny thing about that commented out code. I've tried returning
something like that once from a function:
return { int n = 42; string s = "bar"; }
So basically a struct that has it's members default-initialized with
some values. Unfortunately D thought I was returning a delegate
instead, so I can't use this syntax.
The commented-out "code" is the resulting JSON :)
--
Best regards,
Vladimir mailto:[email protected]