eclipse-archived / golo-lang

Golo - a lightweight dynamic language for the JVM.
http://golo-lang.org/
Eclipse Public License 2.0
478 stars 91 forks source link

`fun` allows references of local functions from the outside #319

Closed jponge closed 7 years ago

jponge commented 8 years ago

Spotted by @yloiseau in https://github.com/eclipse/golo-lang/pull/312#issuecomment-157657194

jponge commented 8 years ago

Given:

    module Other

    local function bar = |x| -> x

and:

    module Test

    local function foo = |x| -> x

    function main = |args| {
      let f = fun("foo", Test.module)
      println(f(42))

      let b = fun("bar", Other.module)
      println(b(42))
    }

then the following works when it should not:

    $ golo golo --files other.golo test.golo 
    42
    42