Re:Roll your own JavaScript runtime, pt. 3
by suavesito on Thursday May 04, 2023 @07:30PM
(#35823478)
I don't want to start a 0-index war, but there is a great argument I read once and wave to share. Indexing can be tough as two different things, selecting or offsetting. When selecting you start from the first (1) option. When offsetting you move zero (0) from the first option.
0-index arrays express offsets, 1-index arrays express index selection. In C (and family) arrays start at zero because they offset, `a[i]` literally means `* (a+i)` (you actually can write `i[a]`, it will work and be valid). For other language selecting 1 base indexing is not a weird option, I'd argue.
Re:Roll your own JavaScript runtime, pt. 3
by paulddraper on Thursday May 04, 2023 @08:01PM
(#35823738)
If you ever need an ally for 1-indexed, you can point people to PostgreSQL.
JavaScript as it is today is a vastly more ergonomic and fluid experience, and I am saying this as someone that has written tons of both.
The embedding experience with Lua is likely much more form fit than JavaScript (sandboxing, etc). I’m strictly speaking about syntax and language features.