title: golang: implicit vs explicit func definition
body: <p>Consider this package:</p>
  
  <pre><code>package A
  var X="change me"
  var Y=func(i int) int { return i*i) }
  func Z(i int) int { return -i) }
  </code></pre>
  
  <p>The two explicit variables (X,Y) can be changed in another package, say main...</p>
  
  <pre><code>package main
  import "A"
  func main () {
      A.X="done"
      A.Y=func (i int) int { return i*i*i }
      print(A.X,A.Y(7))
      //... but A.Z apparently can't be changed.
      //A.Z=func (int i) int { return i*i*i } //main.go:8: cannot assign to A.Z
  }
  </code></pre>
  
  <p>Obviously there's a difference between defining a func variable (like Y) and an explicit func (like Z). I have googled this but not found much in the way of enlightenment. It almost seems as if var SomeFunc=func (...) defines indeed a variable, but func SomeFunc(...) defines a constant.</p>
  
  <p>PS: A small goodie I found while researching this which I have not seen mentioned in the Go books I've read so far. A dot before a package import imports names without them having to be qualified:</p>
  
  <pre><code>package main
  import . "A"
  func main () {
      X="done"
      Y=func (i int) int { return i*i*i }
      print(X,Y(7))
  }
  </code></pre>