* Run regular code at run time - does this just error if you try to use const on something that depends on a runtime value?
* Add your own optimizations to the compiler - isn't this very dangerous, especially if optimizations from various sources of code get combined? Even if your optimizations are valid (which there seems to be no guarantee of), computer math is notorious for being different from real math. People unaware of the nuances of integers rolling over or floating point seem like they could easily shoot themselves in the foot here.
Yep. For example `const foo = stdin.readLine()` would result in "Error: cannot evaluate at compile time: stdin".
As for your second point. I haven't used this feature personally but I have heard that the compiler will tell you exactly where these optimisations are applied. You can also disable these optimisations very easily during compilation.
* Yes, with compiler plugins
* Yes, with macros
* Maybe. I think that you could use a compiler plugin
to do arbitrary transformations on all the code in a
module, but I haven't seen an implementation.
* Yes
* What garbage collector?
* Yep
* Kind of. Any method can be invoked as a function with
the <type>::func(val, args...) syntax, but the
opposite's not true.
* Check
* Yep, via Emscriptenhttps://www.reddit.com/r/rust/comments/2yfsi9/rust_to_js_wit...
* Haskell can run regular code at compile-time (But it is slow, using ghci/TH)
* Haskell can add optimizations (rewrite rules and plugins). I think Haskell innovated rewrite rules and Nim probably was inspired by that?
* Binding to C easily is also a Haskell feature
* Type safe sets and arrays of enums: Is this not just a library? Haskell sets and arrays of enums are type-safe by default?
* Unified call syntax is true of Haskell too
* Compile to Javascript -- Haskell can do that too
- Predictable performance (lazy evaluation is problematic)
- Easy to achieve high performance
- Easier to read, even for non-specialists
- I'm much more productive in it
- Multi-paradigm: Nim is mostly imperative, but OO and functional can be mixed as well.
http://hookrace.net/blog/conclusion-on-nim/That's the point! I know many languages and Nim is by far the most productive one. It's like coding in Python with the assurance that the compiler will catch many errors that would cause runtime errors in Python. That assurance makes coding in Nim faster than in Python because I don't have to think so much about avoiding runtime errors.
Does Nim compile to C99 ?
If someone were to ask what's wrong with Nim, what would you say are the things that need to be fixed?
- http://hookrace.net/blog/what-is-special-about-nim/
- http://hookrace.net/blog/what-makes-nim-practical/
Summary by benhoyt: https://news.ycombinator.com/item?id=8822918