my concern is that Nim automatically importing system.nim causes too many non-essential symbols to be imported; I'd prefer symbols to be imported explicitly.
in C++, nothing is imported by default in D, object.d is relatively small in comparison
In Nim, symbols that are not used are eliminated and not compiled. By used I mean a usage can't be traced from the MainModule you invoked your compilation on.
It is superb approach in my opinion, I finally have a language where I am not concerned with importing large module that can import 100 other modules (shivering from C++/Boost horror). If I am using one function from that module, this is all that gets compiled.
Even garbage collector will be eliminated if you will write a program that does not use string, seq, ref anywhere.
All magics are in system module, compiler is useless without them. You can't even add two integers without system module. int and + are defined in system module.
Unlike C++ and D where large parts of functionality is builtin into compiler, in Nim if functionality is not declared in system module then it does not exist. Everything Nim compiler can offer to a user is declared in system module explicitly.
ok this seems to work: import system except foo, bar (and also from system import nil works too, with obvious consequences)
this is very useful, to allow seamlessly overriding symbols defined in system with minimal intervention, which can be useful for many things, including debugging.
import system except CompileDate, echo
import overrides/system_modif # re defines echo, CompileDate
echo CompileDate
# no need to prefix with system_modif.echo system.CompileDate
I wouldn't bet this feature stays in the language...
IMO it should, to enable use case I just mentioned above
+1 it feels wrong that too much stuff being imported by default.
Like the io module. It pollutes the default environment. And on some platforms (Browser for example) files and stdin/stdout doesn't make sense.