[nim-dev] Re: Nim vs Scala (not holywar). Compare functions for strings
- From: "Garry_Galler" <dmarc-noreply-outsider@xxxxxxxxxxxxx> (Redacted sender "ggaller" for DMARC)
- To: nim-dev@xxxxxxxxxxxxx
- Date: Sun, 17 Jul 2016 09:52:05 +0000
you can also put all of the helpers you coded into a package and publish it
with Nimble
Some things, owing to their prevalence, in my opinion have to be part of
standard library of language.
For example, the string methods\\functions **toCharArray**, **getBytes**,
**reverse** are in many languages.
And programmers don't need to invent anything.
Could not a little to expand the standard string module?
If everyone starts writing the helpers modules for elementary things, it won't
be good style for language.
Simple example. In **Nim** there are modules for work with almost all built-in
collections, however Tuple was for some reason ignored.
There is an informal tuples package which it meets a lack. But here comes some
inconsistency naming functions.
For type sequences (sequtils module) there are **foldl** and **foldr**
functions and they have syntax **@[1,2,3].foldl(a+b)**.
For type tuple (tuples module) there is **fold**, where syntax already another:
**(1,2,3).(`+`)**.
For type List (nimfp module) there is **foldLeft**: **asList (1,2,3).foldLeft
(0, (x, y) => x + y)**.
That we have: three types, three names of the same procedure, three syntaxes of
use.
**Araq**, if you are a long time programmed in Scala, then what's wrong with
the unification of methods in Scala?
PS: All this is just the opinion of a beginner (though who had to deal with a
dozen languages ââand, therefore, has a tendency to compare them :-)).
I really like **Nim**, and I am very grateful to you for your work, and I also
like all who use it, I want it to be even more powerful and more convenient.
Other related posts: