Comment by jackcviers3

2 years ago

In the lexical closure doc example, why choose to show variable name shadowing? What is the purpose of `let x = 3` in the below?

let x = 3 func foo(x: Int) { fn inc() { x + 1 } // OK, will return x + 1 fn fail() { y + 1 } // fail: The value identifier y is unbound. }

`foo` also captures the global `x`, but shadows it with the parameter `x`.

Can `Generics` be generic - are there higher kinds? Are they all invariant, or do they have variance and if so what is the notation?

Maybe I missed it - can methods be destructured from structs? Can enums have methods?

Is there partial application for methods and functions?