Arrays being truthy in JS still catches me out sometimes.
In Python or Lisp, empty lists are falsey and truthiness is safe and idiomatic.
miniblog.
Related Posts
On storing ASTs in flat arrays for performance, and the relationship with bytecode interpreters:
zsh is generally wonderful, and it's sufficiently like bash/POSIX sh that it works.
However, it uses 1-indexed arrays, whereas bash uses 0-indexed arrays. This totally caught me out.
A decent part of VMs being faster than AST interpreters is just memory layout AIUI.
VM instructions are largely flat arrays, so there's less pointer chasing.