Curl wrapper round two

jdrewsen jdrewsen at nospam.com
Sun Jun 19 11:55:28 PDT 2011


Den 19-06-2011 19:42, David Nadlinger skrev:
> On 6/19/11 7:34 PM, jdrewsen wrote:
>> I guess that I can initialize variables in the opCall and that way the
>> user should not have to remember to initialize variables?
>
> Yes, you can just do:
>
> ---
> struct Foo {
> Foo static opCall() {
> Foo result;
> result.<whatever> = <somevalue>;
> return result;
> }
>> }
> ---
>
> The thing is that the static opCall is not invoked if the user writes
> »Foo foo;« instead of »auto foo = Foo();«, so you need to carefully
> document that users need to use the opCall syntax.

This shouldn't be a problem really since the struct is private.

/Jonas


More information about the Digitalmars-d mailing list