On 7/28/2016 1:33 AM, Ethan Watson wrote:
1) Declaring a function pointer with a ref return value can't be done without
workarounds.

Try compiling this:

ref int function( int, int ) functionPointer;

It won't let you, because only parameters and for loop symbols can be ref types.
Despite the fact that I intend the function pointer to be of a kind that returns
a ref int, I can't declare that easily. Easy, declare an alias, right?

alias RefFunctionPointer = ref int function( int, int );

C/C++ have essentially the same problem, if you want to declare a function pointer parameter that has different linkage.

The trouble is there's an ambiguity in the grammar. I don't really have anything better than the two step process you outlined.


====================
4) Forward declaring a function prototype means I can never declare that
function elsewhere (say, for example, with a mixin)

Do you mean:

  void foo();
  void foo() { }

?

Reply via email to