f# duplicate definition

会有一股神秘感。 提交于 2019-12-01 02:20:47

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/6063681/f-duplicate-definition

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!