Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate default parameters #21

Open
cor3ntin opened this issue Feb 17, 2022 · 1 comment
Open

Investigate default parameters #21

cor3ntin opened this issue Feb 17, 2022 · 1 comment

Comments

@cor3ntin
Copy link
Collaborator

  • 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

@lewissbaker
Copy link
Collaborator

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants