Why doesn't infinite recursion hit a stack overflow exception in F#?
        Posted  
        
            by 
                Amazingant
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Amazingant
        
        
        
        Published on 2012-11-30T23:02:18Z
        Indexed on 
            2012/11/30
            23:03 UTC
        
        
        Read the original article
        Hit count: 291
        
I know this is somewhat the reverse of the issue people are having when they ask about a stack overflow issue, but if I create a function and call it as follows, I never receive any errors, and the application simply grinds up a core of my CPU until I force-quit it:
let rec recursionTest x =
    recursionTest x
recursionTest 1
Of course I can change this out so it actually does something like this:
let rec recursionTest (x: uint64) =
    recursionTest (x + 1UL)
recursionTest 0UL
This way I can occasionally put a breakpoint in my code and see the value of x is going up rather quickly, but it still doesn't complain. Does F# not mind infinite recursion?
© Stack Overflow or respective owner