No, those your examples don't really work too — the procedure gets remembered 
at first variable's declaration, and those of other variables will be ignored.
    
    
    type
      BinaryTree[V; compare: static[proc(a, b: int): bool]] = object
    
    var tree1: BinaryTree[int, proc(a, b: int): bool = (echo 1; a < b)]
    echo tree1.compare(20, 30)
    
    var tree2: BinaryTree[int, proc(a, b: int): bool = (echo 2; a < b)]
    echo tree2.compare(20, 30)  # will call the first procedure, printing "1"
    
    
    Run

The same for `const`. 

Reply via email to