Hacker News new | ask | show | jobs
by shiomiru 329 days ago
Nim's import rules are part of its generalization of OOP's obj.foo() syntax. That is, in Nim, you don't have to put "foo" in a specific class, just set the first parameter of "foo" to the type of "obj", and this only works if you don't have to qualify "foo" (similarly to OOP languages...)
1 comments

I don't see how Nim's import is necessary for that to happen. You can allow the user to specify items to import without the qualifier (like Python's `from lib import foo`), and the universal function call syntax would work, too.
That is allowed, with the exact same syntax as Python. But then you still lose the qualification so I don't see any benefits, it's just more boilerplate to constantly adjust, git conflicts to fight with, etc.