As I am rediscovering namespaces as context indicators, I naturally tried to do 
see the limits of the current system to see what I can do and what I can't.
    
    
    # FooBar.nim
    proc f(x: int): int =
      return x + 2
    
    
    
    # main.nim (or whatever)
    from FooBar as baz import nil
    
    # Expected:
    discard f(2)        # FAILS
    discard FooBar.f(2) # FAILS
    discard baz.f(2)    # SUCCEEDS
    
    # Surprising (to my eyes)
    discard 2.baz.f     # FAILS
    

Two things:

  * Is there a way to make the import statement less ugly while still avoiding 
namespace pollution and conveying the same intent? If not, would you consider 
adding some sugar to make it appear more idiomatic? (not that anyone would be 
forced to use it)
  * Is there a strong reason why the last statement in the code fails? 


Reply via email to