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

What kind of type system does Walt (intend) to have? #109

Open
JobLeonard opened this issue Mar 20, 2018 · 3 comments
Open

What kind of type system does Walt (intend) to have? #109

JobLeonard opened this issue Mar 20, 2018 · 3 comments

Comments

@JobLeonard
Copy link

JobLeonard commented Mar 20, 2018

Not sure if this is purely a question, or a discussion. Although I'm sure it will evolve into the latter ("Hi, I'm JobLeonard and I like to start discussions. Apparently").

When it comes to type systems it's easy to get stuck in opinionated arguments without realising we're not building on the same premises. If we don't fully realise where we don't see things the same way, we can't really get anywhere with the debate.

For example, I can't really evaluate @iddan's suggestions for using types in issues like #103, #104 and #108, because I don't know what the capabilities of Walt's type system are😅. In turn, it could be that iddan's ideas about it don't match what ballercat has planned either (which is not to say he's wrong; it just means that this should be discussed, no?)

Anyway, I would love it if Walt steals as many good parts from Julia's type system as seems sensible, while still staying familiar to JS programmers. Given the difference in ambitions, and the constraints they use to allow their Type System to be so elegant, I doubt that the more interesting bits about it could be copied, but maybe there is some nice inspiration there 🙃.

@ballercat
Copy link
Owner

It's a static type system with C-like struct types for objects. It's quite simple and without much bells and whistles. The truth is that WebAssembly itself enforces the basic numerical types and even indirect function calls already. Walt compiler needs to do very little at compile time to prevent basic mistakes.

When it comes to type systems it's easy to get stuck in opinionated arguments without realising we're not building on the same premises. If we don't fully realise where we don't see things the same way, we can't really get anywhere with the debate.

I've been kind reminding folks that it's a better syntax for WebAssembly and not a new language. I'm not sure how a (more complete?) type system would drive that point forward. Or rather, I wouldn't know where to start or what goals that would achieve at this point. Some of the conversation tangents seem to be describing completely different levels of abstractions :/

I think I honestly miss the point of a more complex type system when you literally can edit any bit of memory you choose during runtime. For example, you may map any struct type onto any memory location.

@iddan
Copy link

iddan commented Mar 21, 2018

Maybe walt should have it's own Flowtype

@JobLeonard
Copy link
Author

JobLeonard commented Mar 25, 2018

I think I honestly miss the point of a more complex type system when you literally can edit any bit of memory you choose during runtime. For example, you may map any struct type onto any memory location.

I mean, I think that this is not what you're really trying to say, but one way to interpret this sentence is equivalent to "what is the point of having variable names and functions if you can just memorise and type in the plain bytecode?"

Good abstractions help. BTW, if it's OK with you I'm sticking to the C-for-the-web analogy because if Walt was purely WASM-with-better-syntax, it would pretty much done already, no? (in terms of design)

None of us here want Walt to have a type system that lets you implement quicksort through types alone - I mean that's cool too but the peeps who want that should just wait for Elm or PureScript to target WASM.

But since C came along, a lot of different languages came out, a lot of PL research has been done, and a lot of new good ideas have been tried out. Not all of that stuff is Haskell-like in it's complex abstractness.

I'm still looking into a few articles that explain this better, and also thinking about what I do think would help here. But I think that a good, but still simple, type system could help not just with programmer convenience, but also with simplifying the Walt core

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

3 participants