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

Type inference #143

Open
piranna opened this issue Sep 3, 2018 · 1 comment
Open

Type inference #143

piranna opened this issue Sep 3, 2018 · 1 comment

Comments

@piranna
Copy link

piranna commented Sep 3, 2018

Feature Request

Overview

Add support for type inference, so walt itself can discover the type of a variable from the values it's being assigned. For safety and simplicity this can be done in a strict way, don't allowing to change the type of a variable. This is something similar to how Rust types works. In a next iteration it would be changed to create new hidden variables transparently to the user if the type is different.

Impact

Medium. The most difficult part would be the type inference, but following the AST would not be too much difficult.

Details

This would allow to write more Javascript-like code, in most cases types would only be needed to be set in the function signature.

@jarble
Copy link

jarble commented Nov 3, 2019

This has already been done in AssemblyScript, which compiles a variant of TypeScript to WebAssembly. Walt's syntax is very similar (if not identical) to AssemblyScript, so type inference is probably feasible.

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