emscripten

Vladimir Panteleev vladimir at thecybershadow.net
Wed Dec 15 10:07:34 PST 2010


On Wed, 15 Dec 2010 12:27:48 +0200, Andrej Mitrovic  
<andrej.mitrovich at gmail.com> wrote:

> On 12/14/10, Vladimir Panteleev <vladimir at thecybershadow.net> 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:vladimir at thecybershadow.net


More information about the Digitalmars-d mailing list