Skip to content

FABLE issues

Tom Clarke edited this page Feb 16, 2019 · 5 revisions

FABLE v2.x Changes

FABLE has become more compatible with dotnet core F# since V2.00. Specifically the number issues are now MOSTLY fixed and now documented on a page linked off the compatility guide.

First check the FABLE compatibility docs

Compatibility Issues in Fable 1.x now mostly fixed

Now mostly these issues are resolved, see above.

Issues with integer arithmetic. The preferred type for 32 bit assembler simulation is uint32. However Javascript has only int64 type, and all integer code is transpiled into int64 (or uint64).

The problems happen due to incompatibility of JS and .NET on converting between different in types. Specifically, int negative numbers converted to uint will sometimes be rounded to 0, and sometimes not. But code under FABLE does not do this the same way as code under .NET.

Best workarounds. Currently the best solution for affected code is to code everything in F# int64. Then all numbers are positive, conversions to/from uint32 work as expected. An int64 mask of ((1L <<< 32)-1L) can be used to extract the LS 32 bits and ensure that higher order bits don't cause surprise. Signed integer (64 and 32 bit) seems pretty robust, the problems occur with unsigned. Note that going from int to int64 will sign extend so if this is a problem mask to 32 bits:

fun (n:int64) :int64 -> n &&& ((1L <<< 32)-1L)

Where is this done. currently the worst problems have been found in the DP makeLiteral function since this does a lot of complex bit arithmetic: this has been converted to int64 along with the literal parse representation.

Unsigned long ranges

Another problem is FABLE issue. This will probably get fixed!

Clone this wiki locally