I just saw that tread:

[https://www.reddit.com/r/Python/comments/6gwv4a/a_glance_at_the_pythonlookalike_nim_programming](https://www.reddit.com/r/Python/comments/6gwv4a/a_glance_at_the_pythonlookalike_nim_programming)/

Seems to be started by Mr Libman. I have only skimmed it, but it seems to 
contain some unjustified critics. Libman, I hope you will come back to the 
thread and correct false critics? Dom already does it very well, but I guess he 
has to do more important stuff.

>From that tread

> If so, that's a good thing. What if I define a function in my code that has 
> the same name as one in the unit I imported though?

Dom replied:

"You'll also get an error. What other alternative is there? Nim randomly 
choosing the function for you? I'm guessing Python will give an error in this 
case too, except it will be at runtime which is far worse.

Edit: I just tested this. It seems that Python doesn't even give an error for 
this case, but just overwrites the definition (only tested in the REPL, maybe 
the behaviour is different in a source file), but damn that seems pretty bad."

I had always the feeling that I CAN overwrite procs in my own code:
    
    
    import unicode
    import strutils
    
    proc isUpper(c: char): bool =
      echo "isUpper() called"
    
    echo isUpper('A')
    #echo isUpper("A")
    
    
    
    $ ./qu
    isUpper() called
    false
    

Seems to work fine, and it is what I had expected.

Reply via email to