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

var should implement function_like directly #272

Closed
frenchy64 opened this issue Feb 16, 2025 · 2 comments
Closed

var should implement function_like directly #272

frenchy64 opened this issue Feb 16, 2025 · 2 comments

Comments

@frenchy64
Copy link
Contributor

frenchy64 commented Feb 16, 2025

var should implement callable directly.

TODO is here

/* TODO: Move call fns into var so we can remove these checks. */

function_like is here:

concept function_like = requires(T * const t) {

@frenchy64 frenchy64 changed the title Implement callable in var var should implement function_like directly Feb 16, 2025
@jeaye
Copy link
Member

jeaye commented Feb 16, 2025

We're not using function_like right now. We inherit from callable and override the fns. The main reason is that inheritance grants us default behavior for all arities we don't care about. That default behavior throws an arity exception. By using a concept for this, we'd need to have every callable implement every arity. Most of them would just throw the arity exception anyway.

I have a local TODO that we might be able to use CRTP with callable so that virtual dispatch is not required. This would require some exploration, though.

@frenchy64
Copy link
Contributor Author

Ah thanks. I wasn't seeing the full picture.

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