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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request][move-compiler-v2] allow unconstrained generic inline functions #12680

Open
brmataptos opened this issue Mar 26, 2024 · 2 comments
Labels
enhancement New feature or request stale-exempt Prevents issues from being automatically marked and closed as stale

Comments

@brmataptos
Copy link
Contributor

馃殌 Feature Request

While it's unsafe to allow instantiation of generics in general without traits or other constraints, we can probably allow inlined functions to be used with arbitrary generic type parameters (a la traditional C++ templates) by re-doing type inference/checking on the inlined code during inlining, and complaining then if the type parameter doesn't have needed methods/operations.

Might be a stop-gap until we have traits.

@brmataptos brmataptos added the enhancement New feature or request label Mar 26, 2024
@wrwg
Copy link
Contributor

wrwg commented Mar 26, 2024

I don't think we want C++ semantics. At the team discussion last October, there was even a large opposition against duck typing, which is is more harmless than this.

It also collides with traits. Its either traits or ad-hoc polymorhism (aka C++), which is independent of inline functions. We decided against ad-hoc overloading last October as well.

Those decisions are reflected in the blog article which documents traits as in Rust and Haskell the way we plan to go.

@brmataptos
Copy link
Contributor Author

I agree that this is hacky and is as bad as duck typing.

We should avoid it and wait for traits.

@sausagee sausagee added the stale-exempt Prevents issues from being automatically marked and closed as stale label Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request stale-exempt Prevents issues from being automatically marked and closed as stale
Projects
Status: 馃搵 Backlog
Development

No branches or pull requests

3 participants