Several modules in the standard library (for example std/sums) have a std/ prefix. What is the reason for this?
Upon further investigation, i noticed that you can also import other standard library modules with the std/ prefix. However, my question still stands.
Hello @konsumlamm,
according to the Nim manual std is a pseudo-directory for imports, meaning you can unambiguously refer to modules in Nim's standard library with the prefix std. If you wrote your own sums module, how should the compiler choose between your module and the same-named one in Nim's stdlib? It can't, hence the prefix std.
New modules are always in std, old modules are somewhere else but std works regardless so that you can forget about the legacy code and always write std /. And you are encouraged to do so.
There are currently no plans to deprecate the older import strutils variant but now that I've said it probably somebody will write an RFC and push for it.
I asked the same question (for a different module) on Nim's Discord server. @Yardanico answered:
From a certain point in time in the past all new Nim stdlib modules are only available in the std "namespace". You can use it for older modules too
Using std should always work, regardless how new a module in the stdlib is. I guess, some older modules like math can be imported without the std prefix to ensure backwards-compatibility