How to have overloaded operator, infix operator with two operands ? e.g

`m .= n()` to mean `m = m.n()`

on:
    
    
     std/nre
    template `.=`(a :var string; b :proc()) =
      a = a.b
    
    var
      p="hello world"
    
    p .= replace(re"\w+", "masked")
    
    echo p
    
    
    Run

fails with
    
    
    : type mismatch: got <Regex, string>
    but expected one of:
    proc replace(str: string; pattern: Regex;
                 subproc: proc (match: RegexMatch): string): string
      first type mismatch at position: 1
      required type for str: string
      but expression 're"\w+"' is of type: Regex
    proc replace(str: string; pattern: Regex; sub: string): string
      first type mismatch at position: 1
      required type for str: string
      but expression 're"\w+"' is of type: Regex
    proc replace(str: string; pattern: Regex; subproc: proc (match: string): 
string): string
      first type mismatch at position: 1
      required type for str: string
      but expression 're"\w+"' is of type: Regex
    
    expression: replace(re"\w+", "hidden")
    
    Run

Please help this need

Reply via email to