Hi everyone,

Being new to Nim and coming from Python, I often find myself struggling with 
imports.

For example, I play with the asynchttpserver module of the standard library, 
and I don't know how to properly import it.

**Solution 1** :

Everything is imported, but is it OK to import/pollute the namespace with 
procedures/types that I don't use ? Does it makes binaries bigger at the end ? 
    
    
    import asynchttpserver
    
    
    Run

**Solution 2** :

Import only what's needed, but it is a bit verbose and you often forget to 
import operator procedure and the compiler is not happy about it.
    
    
    from asynchttpserver import HttpCode
    
    echo HttpCode(200) != HttpCode(404)
    
    
    
    Run

By the way, how do you import operator procedures (like ==) ? Is it possible to 
import an operator procedure for a specific type ?
    
    
    from asynchttpserver import `==`
    
    
    Run

Does it import all == procedures ?

**Extra** :

Is there a way to import all procedures related to a specific type ? In python, 
when you import a class, you have access to all its methods / variables as they 
are defined within the class.

Have a nice sunday 🌤️

Reply via email to