Allow specify numbers with suffixes

Andreas Rossberg rossberg at google.com
Wed Dec 13 09:35:59 UTC 2017


On 13 December 2017 at 02:26, J Decker <d3ck0r at gmail.com> wrote:

>
> My concern would be the non-symmetry/irreversability of this.... (can't
> get out what you put in)
> Factorio uses such suffixes in their mods but that's a total one-off.
> I've not seen real standards anywhere for this sort of thing in any
> language generally.
>

F# includes a system of user-definable units of measure, based on Andrew
Kennedy's pioneering work. The type system checks that they are used
consistently and it can infer that e.g. acceleration (m/s^2) multiplied by
time (s) yields velocity (m/s).

However, the main benefit of all this is the type checking, so I doubt
there is much value for JavaScript. If you just want dynamic checking you
can build respective classes yourself.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20171213/7d42967d/attachment.html>


More information about the es-discuss mailing list