f# duplicate definition

2019-02-17 08:46发布

in F# powerpack math provider source code: I saw this (in lapack_service_netlib.fs)

member this.dgemm_((a:matrix),(b:matrix)) =  
 // allocate results
  let c = Matrix.zero (m) (n)
  // transpose
  let c = Matrix.transpose c
...
  // fixups
  let c = Matrix.transpose c
  // result tuple
  c

Why does this complile? does c get duplicate definition?

标签: f# shadowing
1条回答
倾城 Initia
2楼-- · 2019-02-17 09:30

This is shadowing; at function/class/member scope, any local let bindings will be shadowed by subsequent let bindings to the same name.

See also Shadowing and Nested function

查看更多
登录 后发表回答