Hello Anthony,

I will raise once again the question about accepting null. According to
your POC, null is an acceptable value if it is also declared as a default
value. This is problematic for the scalar types, because they can very well
have a different default value.

An example: There is a check box with three states (check, unchecked and
mixed). This is usually translated to a three state boolean (true, false
and null). The default value of the check box is false.

function set_check_box_state( bool state = false ) { ... }
set_check_box_state( null );  // null will be converted to false here...

Therefore, this cannot work, unless the default value becomes null, which
is against the requirements. What I suggest is something like this:

function set_check_box_state( bool? state = false ) { ... }
set_check_box_state( null );  // works fine

In my opinion this is much clearer, as it separates the notions of the type
and that of the default value.


Lazare INEPOLOGLOU
Ingénieur Logiciel

Reply via email to