On Sat, 21 May 2011 05:15:32 -0400, Simen Kjaeraas
<simen.kja...@gmail.com> wrote:
On Sat, 21 May 2011 05:12:20 +0200, Andrej Mitrovic <n...@none.none>
wrote:
Taken from the docs:
alias int func(int);
void main()
{
if ( is(func[]) ) // not satisfied because arrays of
writeln("satisfied"); // functions are not allowed
else
writeln("not satisfied");
}
It will print not satisfied. But I'm not sure what func is supposed to
be? An alias.. to what? I can't declare variables of its type:
func x;
error: variable test.main.x cannot be declared to be a function
Of course if you write the alias the usual way it will print
'satisfied'. Nothing strange about having an array of functions in D:
alias int function(int) func;
void main()
{
if ( is(func[]) )
writeln("satisfied");
else
writeln("not satisfied");
}
It's the old C syntax for defining function pointers. Well, without the
pointer. And that last part is important, because the latter example is
an array of function pointers, with which D has no issue.
Yes, and I thought we were killing that syntax because of how horrible it
is?
-Steve