atomgalaxy/wg21-cust-points

Investigate default parameters

Opened this issue · 1 comments

  • final need to support default parameters to be able to model the use cases, but that is easy as final functions form a normal overload set that can be a bunch of operator() in the cpo

  • for override/default, we can consider having the defaults on prototypes declaration, such that otherwise compatible override/default implementations are ill-formed if:

    • They have a defaulted parameters
    • The parameters for which the corresponding prototype have defaulted parameters are not constructible from the default value (as they would not be usable)
    • There are multiple matching prototypes (because it would not be possible to determine which default value to pick, or whether there even is a default value)

When an override or default is matched against a prototype with default(s) parameter(s), the initializers of these parameters is attached to the declaration so they don't have to be looked for again

I think we can kind of do default parameters by having final functions that have fewer parameters that forward to customisable functions, providing defaults for the missing parameters.

Maybe not so urgent to add this?