Home:ALL Converter>Is it possible to force a nested function definition to not be a closure?

Is it possible to force a nested function definition to not be a closure?

Ask Time:2014-06-03T18:08:52         Author:Arbil

Json Formatter

Is there a modifier that can be put on a function declaration that will force it to not be a closure? I would like the following not to compile with this supposed modification to inner:

let outer() =
    let i = 7
    let inner() =
        printf "%i" i
    inner()

but to complain about i not defined. The reason for this is safety -- I want to make sure I'm not capturing and perhaps modyfing anything when I'm intending not to, and performance of closures versus functions.

Author:Arbil,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/24012435/is-it-possible-to-force-a-nested-function-definition-to-not-be-a-closure
yy