FABLE translates unsigned long integer ranges into infinite loops
See original GitHub issueDescription
The F# code [0UL..10UL]
when translated via FABLE leads to an infinite loop
Repro code
Please provide the F# code to reproduce the problem. Ideally, it should be possible to easily turn this code into a unit test.
let main(argv[])=
printfn "%A" [0UL..10UL]
Expected and actual results
Expected: list of 11 numbers Actual: loops forever
Related information
fable.io does this. Also FABLE 1.0.6
- Fable version (
dotnet fable --version
): - Operating system: win 10 (translating to .Net Core 2.1.101)
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Why the infinite loop when data type is unsigned int?
The problem is that the loop for(i=count-1;i>=0;--i). will never exit if i is unsigned, because an unsigned integer is always greater than ...
Read more >Extras.fs
A more functional construct on-top of Fable.Core. Contribute to Shmew/Fable.Extras development by creating an account on GitHub.
Read more >What happens if loop till Maximum of Signed and Unsigned ...
Signed char range belongs from -2 7 to 2 7 -1, hence it also goes for the infinite execution if the limit is...
Read more >lb
Easy tiger kau milikku mp3, Places that start with s in canada, Famille daoudi maroc, ... Nirulas home delivery number gurgaon, Bangla natok...
Read more >unsigned long - Variables
Unsigned long variables are extended size variables for number storage, and store 32 bits (4 bytes). Unlike standard longs unsigned longs ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Sorry, I just noticed the range function didn’t deal with longs so I created a specialized one for them. Should be fixed in the next release 👍
@alfonsogarciacaro
The long range lock-up issue remains with 2.0.0-beta-003
A simple range of longs, anywhere in code, creates an infinite loop in the CLI and also REPL2
ofSeq(range( starting long, end long)
I could probably PR this if I knew whether the compiler uses the same JS translation, and if so where ofSeq and range are located? I’m still not good at finding my way round the compiler internals!
It would be nice to deal with as many as possible of the integer corner cases…