When you import unit it's impossible to use let unit = Terran.init(name: "Jim")
Because import would create a const with unit name.
Is there a way to avoid it? It's needed in 1% of cases, and not needed and creates problem in 99% of cases.
And instead of doing import unit as unit when you need it, you do import unit as unitm almost for every second module you use.
Extremely inconvenient.
I did macro require that does that, but it messes the VS Code plugin and compilation error messages.
Maybe just name modules differently from variables, like stdlib does - options, macros, strutils, times ... Also i can't reproduce the issue anywhere but top-level:
import std/strutils
let strutils = "ssss" # fails
import std/strutils
proc main() =
let strutils = "ssss" #ok
echo replace(strutils, "s", "q")
main()
And instead of doing import unit as unit when you need it, in 1% of cases, you do import unit as unit_module almost for every second module you use in 99% of cases.
Extremely inconvenient.
So name your module units.nim. It's a convention too.