Live data from Hacker News

Nim 1.6

nim-lang.org

151–160 of 179 posts

Re: Nim 1.6

#151
The full changelog is here: https://github.com/nim-lang/Nim/blob/version-1-6/changelogs/...

For those who wonder what the 15 extra modules are, here's a quick summary:

Algorithms:

  - enumutils: generate case statements from enums, and utils for holey enums.
  - setutils: adds functionality for the built in `set` type.
  - packedsets: replacement for `intsets` that allows distinct types.
Operating system:

  - tasks: basic primitives for creating parallel programs.
  - sysrand: create cryptographically secure random numbers.
  - tempfiles: create temporary files and directories.
  - vmutils: enable/disable VM tracing in user code.
Javascript:

  - jsbigints: arbitrary precision integers.
  - jsfetch: wrapper for the JS Fetch API.
  - jsformdata: FormData wrapper for the JS target.
  - jsheaders: Headers wrapper for the JS target.
Metaprogramming:

  - genasts: alternative to `quote` for metaprogramming with explicit binding.
Misc:

  - socketstreams: wraps sockets as streams.
  - importutils: allows access to private fields from another module.
  - strbasics: high performance string operations.
You can check out the modules themselves at the stdlib page: https://nim-lang.org/docs/lib.html

There's also loads of quality of life improvements across the board to existing standard library modules and general backend, e.g.:

  - float to string is 10x faster,
  - JSON serialisation is 20x faster,
  - better compiler messages,
  - memory management performance (e.g., ORC is 10% faster)
  - `static[T]` improvements,
  - improve `enum` type conversions and allow `enum` overloading,
  - new design `concepts` that compile faster,
  - build system and cross compilation improvements,
  - unicode operator symbols,
  - VM improvements such as working with `addr` at compile time.

Re: Nim 1.6

#152

I wrote my first Nim app recently (an agent for reporting server data) and I must say, I like the language. It was a quick and painless learning experience. As of now my binary is about 400KB and uses about 1.3MB in memory consumption. Indeed – as others have reported – Nim feels very much like Python, while the superfast compilation time means I can test code changes quickly during the development cycle. For referen…

Have you tried Nimler? It’s pretty nice! I haven’t used it for a year or so.

Re: Nim 1.6

#153
post #27

> Fast compile times: a full compiler rebuild takes ~12s (Rust: 15min, gcc: 30min+, clang: 1hr+, Go: 90s) [2]. Whoa, this really surprised me!

Doesn't that depend on the size of the compiler? Nim can surely be faster than all of them, but that particular figure can't mean anything.

Re: Nim 1.6

#154
post #112
post #110

Earlier quoted context omitted.

One thing I think would be interesting - get listed on Computer Benchmarks Game.

It would be interesting, yes, but the maintainers of that have explicitly refused to add Nim (and other "new" languages).

Think of it as an opportunity for you to publish the measurements you make!

https://benchmarksgame-team.pages.debian.net/benchmarksgame/...

Re: Nim 1.6

#156

Earlier quoted context omitted.

Some counterpoints: Your auto formatter can’t figure out where you missed braces either. Missing brackets in languages where they are optional for single statements (C) has been a source of serious bugs. Also, in Vim, indenting/dedenting a block is just highlighting the lines and using > or <.

> Your auto formatter can’t figure out where you missed braces either. Correct, but I will notice the braces are wrong when the auto-formatter indents things differently than I expect.

And I'll notice the indentation is wrong when the indentation is different than I expect.

Re: Nim 1.6

#157

Earlier quoted context omitted.

Some counterpoints: Your auto formatter can’t figure out where you missed braces either. Missing brackets in languages where they are optional for single statements (C) has been a source of serious bugs. Also, in Vim, indenting/dedenting a block is just highlighting the lines and using > or <.

How does significant whitespace save you from bugs? if expr: doA() doB() Is doB at the correct level? Having text that's invisible change the flow of your program is crazy IMO.

    if (expr) {
        doA()
        doB()
    }
Is doB at the correct level? It's the same thing.

Re: Nim 1.6

#158
post #116

Earlier quoted context omitted.

I have decided that meaningful whitespace is an anachronism. 20 years ago, I liked it a lot . Today, after the invention and normalization of opinionated autoformatters, it means that the autoformatter can't figure out for me how my code should be indented. Which means that, assuming I am using an autoformatter, it creates one more thing that I have to do manually, because the editor can't accurately do it for me. An…

If I don't add a brace, I'll get an immediate error that something doesn't add up. If I mess up indentation, the program will carry on as if nothing had happened.

If you misplace a brace (which is the true equivalent of messing up indentation), the program will also carry on.

Re: Nim 1.6

#159
post #105

Earlier quoted context omitted.

I can't remember exact place where I've seen this discussion (I think it was on the nim IRC), but if I recall correctly, the original line of thought with nim was to take C (because fast/compiled/available-everywhere) and LISP (because flexible/extensible/good-ideas) and add more syntax sugar, so that user would not have to reimplement most of the syntax from scratch (using reader macros/special functions and so on).…

Interesting. No mention of Pascal or its descendants, specifically Modula 2 or 3? From what I understood, that's where Nim got its fast compilation and modules, like OCaml.

If you ignore the whitespace sensitivity, Nim's syntax is actually more similar to Pascal than to Python.

Re: Nim 1.6

#160

> Why use Nim? > One language to rule them all: from shell scripting to web frontend and backend, scientific computing, deep learning, blockchain client, gamedev, embedded, see also some companies using Nim. Does that work in practice? I can't really imagine a single language that would be a good choice for "everything".

Yeah, these kind of statements feel very “empty” to me. That’s probably true that you could do everything with Nim, it’s also true that you can do everything with every language. Should you? That is another question.

Can you show me how to write a frontend web app with C? Or how to make a keyboard driver with Python?
Post reply on HN