Jake Verbaten
Jake Verbaten
This is correct. An array can be mutated in the body of a for loop which invalidates safe access. I guess bounds checking is hard :( ( https://go101.org/article/bounds-check-elimination.html ).
Would the following be ok ? ```js for (let i=0; i
Would it be useful to have two inbuilt types `Array` and `SparseArray` to represent this ?
A fixed length array is rarely used in javascript The amount of usage of `const arr = new Array(MY_SIZE)` vs `const arr = []` shows that 99% of the time...
I guess fixed size arrays are nice for constants but that only solves the loop issue for fixed size arrays. How do you for loop over a dynamic sized array...
Also `Vector` reminds me people of `std::Vector` in C++ ( http://www.cplusplus.com/reference/vector/vector/ ). Might be confusing name for a fixed length array. > Vectors are sequence containers representing arrays that can...
const n is a const variable. It’s type is literally constant due to assignment being an error. It’s only array index accessor that can have an out of bounds access...
I didn’t know a for of loop includes undefined for a holey array. That means both for and for of loops both have x or undefined behavior. Good catch
> Currently @hegel/core doesn't use Hegel itself. I understand, but to get `@hegel/core` to use hegel it would be great if `hegel` CLI outputted 50 type errors instead of `Maximum...
Btw; great project. I'm impressed the `./packages/cli` package compiles and passes the HegelJS type checker. It looks like the `./packages/core` itself uses flow for bootstrapping atm.