While overloading `len` proc with `string` parameter works perfectly fine:
    
    
    proc len(x: string): int =
      return 123
    
    var s: string = "abcd"
    echo s.len # 123
    

the same doesn't seem to take effect in case of indexing operator:
    
    
    proc `[]`(x: string, i:int): char =
      return 'X'
    
    var s: string = "abcd"
    var index: int = 2
    echo s[index] # expeced 'X', got 'c'
    

is it expected?

Reply via email to