Properties
Christopher Wright
dhasenan at gmail.com
Mon Jan 12 15:18:21 PST 2009
Miles wrote:
> ---------
> int func1() { return 1; }
>
> auto a = func1; // 'a' is a pointer to func1
> auto b = &func1; // ERROR, or deprecated way of above
> auto c = func1(); // calls func1 and returns int 1
>
> int function() func2 = func1;
>
> auto d = func2; // 'd' is a pointer to func1
> auto e = &func2; // 'e' is a ptr to ptr to func
> auto f = func2(); // calls func1 and returns int 1
> ---------
So you consider functions to be a reference type, since the value of a
function is not terribly useful. You want the declarations "void foo()
{}" and "invariant(void function()) foo = {};" to be equivalent.
This can work, provided you get properties. Otherwise you're back to
Javaland.
More information about the Digitalmars-d
mailing list