Picolab / pico-engine

An implementation of the pico-engine hosted on node.js
http://picolabs.io/
MIT License
43 stars 8 forks source link

Allow other numeric literals #128

Open 0joshuaolson1 opened 7 years ago

0joshuaolson1 commented 7 years ago

-0.0 is not different from positive zero. Infinity and NaN are parsed as variables but the json standard doesn't include them either. What about ECMAScript 1.5/1.6 values like +2.E+0 that aren't legal JSON (currently no) and 2.E+0 that are legal JSON (also no)?

0joshuaolson1 commented 7 years ago

From a conversation with @farskipper:

Infinity, and NaN especially, would be annoying to constantly check for, and we should not expect KRL users (or programmers?) to understand floating point math.

Instead, let's break from JavaScript's model and use base-10 numbers. They can represent normal floats, and calculations like $0.01 + $0.02 are easier to get right. Some libraries to help:

0joshuaolson1 commented 7 years ago

Thinking ahead: because event:send can communicate across different engines, older engines won't understand these numbers in event attributes.

farskipper commented 7 years ago

I wouldn't worry that much about old engine comparability until we release 1.0.0. i.e. semver rules for 0.x.x are minor releases are breaking when major is 0