1. `echo sparky` doesn't work as you haven't defined the appropriate `$` for 
it.
  2. `sparky.$()` looks like the use of a dot-like operator named `.$`
  3. `$sparky` doesn't work as you've only defined a `$` that takes two 
parameters



Apart from that, it's easy to understand, right? If you want the output "John 
is 11 old" from this program, you can change `$` to only accept a single 
Animal, or you can have use this strange line:
    
    
    echo sparky.`$`(sparky)
    
    
    Run

The expected `$`:
    
    
    proc `$`(x: Animal): string =
      $x.name & " is " & $x.age.int & " old"
    
    
    Run

or:
    
    
    import std/strformat
    proc `$`(x: Animal): string =
      &"{x.name} is {x.age} old"
    
    
    Run

Reply via email to