logoalt Hacker News

ibejoebyesterday at 8:42 PM1 replyview on HN

The Register source has this comment:

    // Registers can't be a record type because the values need to be truncated to 8 bits when writing, so setters are needed
    // This is for the web renderer as Fable transpiles uint8 to Number (more than 8 bits) in JS and doesn't apply any truncation
    // Known non-standard behaviour in Fable (https://fable.io/docs/javascript/compatibility.html#numeric-types)
So, I think, it's just conservatively cleaning the data due to Fable's widening via js Number on the web target.

Replies

debugnikyesterday at 9:20 PM

Oof, thanks for pointing that out, I hadn't noticed and I've only ever used F# on .NET.

That's terrible on Fable's part, the least they could do is truncate. I wasn't aware Fable's translation is so naive.

show 1 reply