nim-wiki/Feature-suggestions.md

82 lines
4.0 KiB
Markdown
Raw Permalink Normal View History

2017-12-13 10:56:37 +00:00
What features would you like to see in Nim
(Use [needed-libraries repository](https://github.com/nim-lang/needed-libraries) for asking for libraries in the Nim Ecosystem.)
2019-07-14 07:50:04 +00:00
2019-07-14 08:08:21 +00:00
- ~~Multi-line strings just like Python.
2019-07-14 07:50:32 +00:00
`"Just like",`
2019-07-14 08:08:21 +00:00
`"this"`~~ There is
```nim
"""Just like
this"""
```
2019-07-14 07:49:29 +00:00
2014-09-10 16:30:27 +00:00
2019-07-14 05:21:33 +00:00
- ~~Additional string concatenation at assignment. Example `let a = "a" + "b"` or `let a = "a", "b"`. Both resulting in the string "ab". `let a = "a", "b"` seems more appropriate since `echo "a", "b"` already works.~~ There is `"a" & "b"`.
2019-07-13 23:08:13 +00:00
2019-07-14 05:21:33 +00:00
- ~~Range to sequence and array. Example `let a = [1..3]` would be the same as `let a = [1, 2, 3]`, both resulting in `[1, 2, 3]`.~~ There is `import sequtils; let a = toSeq(1..3)`.
2019-07-13 22:02:58 +00:00
2015-06-12 22:52:01 +00:00
- "pure" mode - force usage of scoped variables (unless imported by from... import) and exact case match (like golang does).
2014-09-10 16:30:27 +00:00
- lightweight threads with network io multiplexed.
2015-02-03 08:08:07 +00:00
- if Nim had something like goroutine (ie multiplexed on networking and use native threads for other syscalls), then it will be ultimate language for server programming.
2014-09-10 16:30:27 +00:00
- <del>gem like functionality (gem install sinatra)</del>
2015-02-03 08:08:30 +00:00
- [nimble](https://github.com/nim-lang/nimble)
2014-09-10 16:30:27 +00:00
2017-10-25 16:05:05 +00:00
- <del>A cookbook site similar to Python, where users can share code,
mostly snippets. Driven by normal users rather by experts-only.</del>
- [Nim Programming Cookbook](http://nim-cookbook.btbytes.com/)
2014-09-10 16:30:27 +00:00
- A wiki functionality for parts of the documentation so that
users could update the documentation in a simple way (and Araq
could take these suggestions and approve or reject them
quickly).
2017-08-25 10:07:12 +00:00
- <del>A pastebin for nim on the Nim Homepage or somewhere else.</del>
2014-09-10 16:30:27 +00:00
- Allow multiple ranges (eg 1..3,5..8), handle reverse ranges (eg 5..1, 3.. -3)
2017-12-13 11:06:21 +00:00
- <del>echo automatically handle simple display of sequences (similar to repr)</del>
2014-09-10 16:30:27 +00:00
2017-12-13 11:06:21 +00:00
- <del>vector and matrix maths (or include a port of an existing library)</del>
2018-04-05 13:21:28 +00:00
- [nim-glm](https://github.com/stavenko/nim-glm)
- [Arraymancer](https://github.com/mratsim/Arraymancer)
- [neo](https://github.com/unicredit/neo)
2014-09-10 16:30:27 +00:00
- include a do while loop (or equivalent)
2018-04-05 13:21:28 +00:00
- <del>% formating extended to include math precision (like provided by formatFloat, but in a concise % syntax way)</del>
- [strformat](https://nim-lang.org/docs/strformat.html)
2014-09-10 16:30:27 +00:00
- easier sorting, that doesn't need wrestling with types.
- a ternary condition - like ?: in C, or iif()
2015-02-03 08:08:07 +00:00
- You can do: ``if cond: a else: b``, IIRC the ``?:`` won't make it into Nim.
- A user-defined ternary operator is entirely possible (and really simple).
2014-09-10 16:30:27 +00:00
2017-08-25 10:07:12 +00:00
- <del>a simple way of indexing the last element of an array or sequence, to avoid long-hand code like ``arr[arr.len-1]``</del>
2017-10-16 12:30:25 +00:00
- You can do: ``arr[arr.high]`` or ``arr[arr.low]`` for indexing the last and first element or an array or sequence or ``arr[^1]`` for the last element.
2014-09-10 16:30:27 +00:00
- a shorthand way of discarding the return value of a proc (to improve readability)
- a shorthand initialization of arrays or sequences, eg var x: array[0..25, int] = -1
would initialize all elements of x to -1
- Not possible until result type overloading and result-type generic match is introduced to the language.
2014-09-10 16:30:27 +00:00
2017-08-25 10:07:12 +00:00
- <del>array/sequence comprehension</del>
- They are present in the ``future`` module of the standard library.
2014-09-10 16:30:27 +00:00
2017-10-16 12:30:25 +00:00
- <del>introspection like python's dir()</del>
- Possible via metaprogramming
2014-09-10 16:30:27 +00:00
2015-02-05 18:19:53 +00:00
- scoped imports, like D, Ada, and Ocaml
2016-02-01 17:03:43 +00:00
- Nim documentation provided as .epub (tutorials + manual)
- Missing features from C++/D template (generics in Nim) system, eg variadic generics and generic generic parameters
2018-04-05 13:21:28 +00:00
- <del>Multidimensional arrays, with array slicing, striding, masking, etc. Something along the lines of arrays
in Fortran or, better yet, Numpy arrays in Python would be great. Nim has great potential for scientific
2018-04-05 13:21:28 +00:00
programming, but the lack of multidimensional arrays is a deal-breaker.</del>
2018-05-24 19:44:19 +00:00
- [Arraymancer](https://github.com/mratsim/Arraymancer)
- Either a stable 1.0 release or a stable subset with a guarantee of no breaking changes.