Live data from Hacker News

Nim 1.6

nim-lang.org

71–80 of 179 posts

Re: Nim 1.6

#71
post #48

Earlier quoted context omitted.

I think Nim is in the sweet spot for it. You start with basically OCaml, which is already a great start, add some knobs for tweaking memory management, some for high performance, and you're in a great places. Compiling to native and to JS allows you to do web, cli tooling, applications, high level gamedev. Fast compilation is important for scripting, high level gamedev, exploratory programming, scripting. High perfor…

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).…

Indeed, in fact the original line of thought was[1]:

> [combining] Lisp's power with Python's readability and C's performance.

I'd say Nim still satisfies this very well.

1 - https://web.archive.org/web/20110704041631/http://force7.de/...

Re: Nim 1.6

#72
post #29

Earlier quoted context omitted.

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.

Unfortunately, it's not possible to do everything with every programming language. If thinking of rewrite of some software, it depends does all dependencies, database drivers, authentication, etc exist for some other programming language.

Being able to compile to C, C++, ObjC, and JavaScript natively (and LLVM using https://github.com/arnetheduck/nlvm ), along with an excellent FFI (including to and from Python) means you don't need to rewrite dependencies as you can use them directly. Nim is great at glue code - arguably better/easier than Python.

Along with general language characteristics such as being high level and productive like Python, but with intricate "bare metal" control when you want it, really does make it suitable for writing almost everything.

Re: Nim 1.6

#73
post #69
post #63

Earlier quoted context omitted.

JS is also not fast enough at string manipulation to express its own dev tools, at least if you want to build in seconds and not minutes. The latest incarnation of JS tools seem to be written in Go and Rust (esbuild and another one), not JS. GC is an issue for compilers, or even just front ends, which create huge, fine-grained, linked data structures

Sure, JS isn't ideal for compilers, but it is quite good - typescript is a better and more performant compiler than many languages have, as just one example. You wouldn't be crazy for choosing JS for a new compiler project, even for work that had nothing to do with JavaScript. (You would be pretty crazy to choose js to build a rich data science backend, in comparison). I do agree the GC rules out some use-cases like…

Please don't write a compiler, that has nothing to do with JavaScript, in JavaScript. It needs correctness, safety and speed, none of which are JS (nor TS) strengths.

You can, but that's a prerogative of all Turing-complete languages.

There are much better languages fit for the purpose, which is the point of this comment thread.

Re: Nim 1.6

#74

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…

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 <.

A botched merge conflict resolution can repeat a block statement just fine, it will have the same effect. And repeating a statement inside a block isn't necessarily better.

Re: Nim 1.6

#75
post #58

What's the state on: - web frameworks / servers ? (ie. is there something like Sanic that is actively maintained ?) I imagine it's too early for a consensus. - database drivers ? (postgresql is important here. I can live without an ORM)

There is plenty of web frameworks and servers, each with differing maintenance levels. You can for example check out Jester[1] and HttpBeast[2] (shameless plug, I wrote these :)).

1 - https://github.com/dom96/jester

1 - https://github.com/dom96/httpbeast

Re: Nim 1.6

#76
post #24

How to run those benchmarks? At that Nim release page: https://nim-lang.org/blog/2021/10/19/version-160-released.ht... Is link to this benchmark: https://web-frameworks-benchmark.netlify.app/result Where nim is 2nd with 200k req/s, but it is using httpbeast: https://github.com/dom96/httpbeast That says it would be more useful to use jester: https://github.com/dom96/jester Jester has 150k req/s. But, when looking at t…

You definitely cannot compare a benchmark result you got on your machine vs. one in (what I believe is) a CI environment.

Re: Nim 1.6

#77
post #56

Earlier quoted context omitted.

Well no language is perfect, but Nim can be used in almost every domain because of it's compilation targets(C, C++, JS) and it's fast compile times(who needs interpretation when compile times are that fast!): * Shell scripting, I still assume most people will just use Bash tho: https://github.com/Vindaar/shell * Frontend: https://github.com/karaxnim/karax or you could bind to an existing JS library. * Backend: For so…

I looked at the emitted JS when the last Nim story came out. It needs some work there. Lots of globals with names that would likely collide with other existing JS.

Yeah, we definitely need to resolve this and it sounds like a fun project! If you or someone else has the time for this I (and I'm sure the rest of the community too) would love to help lead you in the right direction :)

Re: Nim 1.6

#78

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…

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 <.

Practically speaking, it’s almost impossible to miss braces. If you’re copying and pasting, you can place your cursor anywhere inside the desired pair of braces, paste, and the autoformatter will figure it out.

Ideally an autoformatter would also add braces around a one-line if statement as well.

Re: Nim 1.6

#79

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 <.

Practically speaking, it’s almost impossible to miss braces. If you’re copying and pasting, you can place your cursor anywhere inside the desired pair of braces, paste, and the autoformatter will figure it out. Ideally an autoformatter would also add braces around a one-line if statement as well.

it is very possible... I often paste parts of some code into a lambda and missing a brace here and there.

Re: Nim 1.6

#80
I started looking at Nim a few months ago, but I didn't like the feature where it ignores underscores and capitalization. It seems to me that this would make grepping harder on larger projects.

I suppose a linter or style-guidelines-and-not-making-mistakes invalidate this issue. For anyone that has used Nim, has this been a problem in practice?

Post reply on HN