you can borrow like so:
    
    
    type Foo = distinct int
    proc `$`(x: Foo): string {.borrow.}
    
    echo (Foo 1)
    
    
    Run

also, instead of borrowing, you can use `distinctBase` for weird type-general 
nonsense:
    
    
    import std / typetraits
    
    type
      Foo = distinct int
      Bar = distinct float
    
    type Distinctable = concept x
      x is distinct
    
    proc `$`[T: Distinctable](x: T): string = $T & '(' & $(T.distinctBase)(x) & 
')'
    
    echo (Foo 1)
    echo (Bar 2'f)
    
    
    Run

Reply via email to