oprypin / nim-random

Random number generation library for Nim
MIT License
68 stars 13 forks source link

Name Collision with Standard #26

Closed ghost closed 4 years ago

ghost commented 4 years ago

Sorry for the newbie question. But there is already a random module in the standard. Which one will be taken by definition? Are there any rules? Maybe in the nim.cfg file?

Thank you.

oprypin commented 4 years ago

No no, there is already this module, and later the standard library one was added.

ghost commented 4 years ago

Thanks Oleh. But what I mean is this: I have a Nim installation which includes already a random module. Then additionally I install your library with the same name. Which one will be taken when I write import random in my source code?

oprypin commented 4 years ago

That is true, and I don't know :( It is problematic indeed.

I'm surprised there isn't an issue about this because it had been brought up.

ghost commented 4 years ago

I can see that your library is loaded but I don't know why. Skimming through the system nim.cfg file I would actually expect the standard library to be loaded.

Is just funny that you don't know either. Obviously it worked in the past. Should I close the issue or do you think it needs more investigation? I could ask in the Nim forum. Maybe someone there knows a reasonable answer.

oprypin commented 4 years ago

It worked in the past when there was no such standard library module. By the time it was added I wasn't really working on this lib anymore.

It is a real issue, though, so no need to close.

ghost commented 4 years ago

https://forum.nim-lang.org/t/5963

You can choose via import std / random vs import pkg / random.

Maybe documentation needs updating.