If we removed the requirement for the ampersand, along with requiring parentheses for non-property functions, code which expected to call the function without parentheses would silently compile, but not do what was intended.


Consider this...

float handleRequest() {
 return 1.0f;
}

float x = handleRequest; //compilation error

or

auto x = handleRequest;

writefln("%f", x); //compilation error


I think we'd get a compile time error for most cases without significant changes to the compiler. But the edge cases if any can probably be detected at compile time with modifications to the compiler.

Here is an edge case (for reference)...

writefln(x);// will now print the address of the function

Reply via email to