4 ms·
I don't get the concrete failings of nim from the readme. Even though I have one of my own: They should have adopted a python-style import system and not a C-st
by ThouYS 4y ago
I don't get the concrete failings of nim from the readme. Even though I have one of my own: They should have adopted a python-style import system and not a C-style omnibus import system. You don't always have a properly configures IDE by your side to resolve imports.
- xigoi 4y agoQualified imports don't work well with uniform call syntax. How would you write "foo-bar".split("-") with full qualification? "foo-bar".(strutils.split)("-") ?
- snthpy 4y agoYou could have something like import strutils{split, trim} similar to how rust does things. What would be the problem with that?
- xigoi 4y agoNim does have that: from strutils import split, trim Most people don't use it because it's annoying to constantly add and remove imports when changing your code, but it's definitely an option.
- gamache 4y agoIn some languages there is a pipe operator that does the job well. Elixir example: "foo-bar" |> String.split("-") IMO method chaining is a lot better this way, much less desire for monkey patching, etc.
- xigoi 4y agoThere's no need for monkey patching in Nim. x.f(y) is fully equivalent to f(x,y). The functional approach requires currying and data-last parameter order, which are both unidiomatic in Nim.
- gamache 4y agoThanks, TIL! Obviously I have no experience in Nim. This convention reminds me of Perl, which works much the same way. How is it possible, then, to call a function that lives in a different namespace as part of a dot-chain of methods? The Elixir approach does not rely on currying; like much of the language's fancy parts, it's a macro.
- snthpy 4y agoThank you. That is my single biggest gripe about nim as well. If you believe, as I do, that code is read more than it is written, then this becomes a big deal. Clearly readability is important to nim's design so this departure from that seems inconsistent. Also for new people trying to learn the language, it really helps to be able to see what modules/packages functions come from.
- ilaksh 4y agoSee comment above. Nim does have it. Lol.
- giancarlostoro 4y ago> They should have adopted a python-style import system and not a C-style omnibus import system. You don't always have a properly configures IDE by your side to resolve imports. I've had this issue with Python as well, if you use virtualenv for enough projects, you might just run into it, PyCharm is an amazing IDE but sometimes I have to literally reconfigure it a dozen times because it defaults to this or that, or in the more famous case I had: an API written for Python 2 vs a web service written for Python 3 and it was problematic to switch context because you had to change interpreter for entire project, though debugging the two was no issue. I suppose the more obvious fix would of been for me to open the client library directory in a separate PyCharm IDE instance in retrospect, but my point being, even Python can run into this under niche circumstances.