**Krux02:** _in function parameters, you don't need var keyword. Parameters are 
passed by immutable reference by default, only when you want to change the 
argument in the function you need the var declaration._

This is currently not specified, unless you use `{.bycopy.}` or `{.byref.}`. 
Value parameters can either be passed by value or by reference. If you specify 
`{.bycopy.}` for each of the object types above, you will actually run into a 
bug:
    
    
    {.pragma: byX, bycopy.}
    
    type
      animal {.byX.} = object of RootObj
      dog {.byX.} = object of animal
        name: string
      cat {.byX.} = object of animal
        name: string
    
    method say(self: animal) = discard
    method say(self: dog) = echo self.name, ": woof!"
    method say(self: cat) = echo self.name, ": meow?"
    
    proc make_noise(a: animal) =
      a.say; a.say; a.say
    
    proc main =
      var d: dog = dog(name: "Snoopy")
      var c: cat = cat(name: "Garfield")
      d.make_noise
      c.make_noise
    
    main()
    

Reply via email to