On Wednesday, 10 August 2016 at 20:35:23 UTC, Dicebot wrote:
The first DIP has just landed into the new queue. It is a (...)

The wording is unclear in the section "Implicit Conversion of Function Pointers and Delegates".

It says "scope can be added to parameters, but not removed."

The trouble is that the word "added" can be understood in two opposite ways.

When you assign an address to a pointer variable, you can say that:

- you are assigning a new runtime value, so you are adding scope of parameter of the right hand side to the otherwise unscoped parameter of the left hand side, e.g.

alias T function(T) fp_t;
T bar(scope T);
fp_t   fp = &bar;   // Ok

- you are converting to a new variable, so you are adding scope of param of the left hand side to an otherwise unscoped param of the right hand side, e.g.

alias T function(scope T) fps_t;
T foo(T);
fps_t  fp = &foo;   // Error

Half-jokingly, I think its good to recognize that there is an ambiguity before multiple authors implement things with different assumptions and have a month-long discussion on github. :)

More seriously, this wording may make its way to documentation after the design is implemented.

If wording is fixed, I suggest also checking if all examples are correct.

Reply via email to