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

Map native functions to builtin operators #214

Open
katat opened this issue Oct 24, 2024 · 2 comments
Open

Map native functions to builtin operators #214

katat opened this issue Oct 24, 2024 · 2 comments
Labels

Comments

@katat
Copy link
Collaborator

katat commented Oct 24, 2024

It would be nice to support builtin operators like + - / % << >> etc for both field and uint types.

Instead of implementing them as via builtin interfaces, like this pending PR, it would be better to implement them in native noname code, which are easier for maintenance.

To achieve this, we would map these operators to the native functions, such as uints.

The mapping could be in the MAST phase, where the builtin operator AST nodes can be replaced with function calls to the native stdlib.

@katat katat added the medium label Oct 24, 2024
This was referenced Oct 24, 2024
@mimoo
Copy link
Contributor

mimoo commented Oct 25, 2024

So as long as a type implements a known signature (e.g. Type.add(Type) -> Type) we would automatically route a + to that function right? Sounds like a good idea

@katat
Copy link
Collaborator Author

katat commented Oct 28, 2024

Yes, we will need this assumption until noname support trait.

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

No branches or pull requests

2 participants