4 ms·
If a func takes a TypedArray, how will the language know which methods can be called on it? Won't you have to type all of the Javascript DOM libraries? You'd ha
by iso8859-1 5y ago
If a func takes a TypedArray, how will the language know which methods can be called on it? Won't you have to type all of the Javascript DOM libraries? You'd have to separate the mutating ones.
- brundolf 5y agoYes, typing the standard libraries is going to be a significant task, but the author of Elm did it so I figure it should be feasible. Like Elm, I plan on exposing an opinionated subset of the native APIs, and for example I may exclude the mutating DOM APIs in favor of declarative ones. This is territory that's still up in the air though; I've got a ways to go before I really have to pin this down.
- brundolf 5y agoEdit: At first by TypedArray I thought you meant Array<...>; I forgot there was an actual TypedArray in JavaScript. The answer is roughly the same though: I'll be giving Bagel types to any built-in JS APIs that get exposed, and not all of them will be included (though the list could grow over time). I'm not sure about TypedArray specifically. Generally on this sort of thing I'm looking to Elm for guidance: it's about the same level of application-focused, batteries-included, curated language that I'm aiming for. I don't believe TypedArrays are available in Elm right now (though from a quick search it looks like there's been a little bit of interest here or there). One thing that will be interesting (thinking out loud here) is exposing certain browser APIs where both the side-effect and the return value are important, since that can't really be expressed in Bagel semantics as-is. I don't think there are a huge number of those, but it will be fun to tackle those cases.