spec
spec copied to clipboard
be courageous
Staying close to the JavaScript specification is good, however be courageous when it makes sense to diverge from js bugs / bad specification:
- 015, 0001 bad
- 0o77 (octal, base 8) ok
please do not strictly copy other bad behaviour:
- typeof null == 'object' // but
- null instanceof Object == false
- "foo" instanceof String == false
- "foo" instanceof Object == false
- true instanceof Boolean == false
- 12.21 instanceof Number == false
- [0, 1, 2] + [3, 4, 5] == '0,1,23,4,5'
- typeof NaN == 'number' // but
- NaN != NaN
- NaN instanceof Number == false
- [] == ![]
- '3' - 1 === 2
- '3' + 1 === '31'
- 0.1 + 0.2 != 0.3
- .1*.2 != 0.02
- 4 in [2,4] == false // "cedar" in {"cedar":"maple"} ok
- var x,i = 1 // x == undefined
Suggested minimal innovations
- [] {} should be falsy, as is ''
- 'in' operator should work as expected
- typeof operator should work as expected
- and , or as synonyms for &&, ||
That's it for he moment we don't want to go astray too far
PS: Fantastic project, I was very plased to see that https://github.com/01alchemist/TurboScript was not abandoned but rather push to higher ground.