News for hackers. Stuff that matters.
Re:What I Learned Making My Own JIT Language by vanderZwan on Wednesday June 27, 2018 @04:38PM (#17411641)
> That is how JavaScript "Array" objects work. Array indexes are coerced to a strings, as they are for all objects.

Well, according to the spec. All modern VMs make optimisations for small integers, which is allowed as long as the behaviour is in accordance to the spec.

Re:What I Learned Making My Own JIT Language by arghwhat on Wednesday June 27, 2018 @06:06PM (#17412263)
Of course, but the language spec severely limit what optimizations can be done.

For example, V8 will happily give you a proper array if certain criteria is met, but it must always be ready for you trying to index it with a string, which means that it must attempt to parse the string as a numeric value. This means deoptimization checks, or in the worst case, a non-optimized array.