Live data from Hacker News

Mastering Nim – now available on Amazon

nim-lang.org

101–106 of 106 posts

Re: Mastering Nim – now available on Amazon

#101
post #81
post #63

Earlier quoted context omitted.

Glad to hear you're interested in Nexus. The ORM currently uses db_postgres (from Nim's stdlib) only. I'm going to implement support for db_mysql and db_sqlite as well, it should be easy enough given how similar the API for the stdlib DB drivers are. Actual work on DB drivers is out-of-scope for me though. I noticed there is an async Postgres driver available: https://github.com/treeform/pg . I don't know how well te…

I did some testing with Nim a couple of years ago for HashBackup. Here's one of the db_sqlite issues I created: https://github.com/nim-lang/Nim/issues/13559 I had much better luck with tiny_sqlite: https://github.com/GULPF/tiny_sqlite

It seems that issue is now fixed. Either way, Nexus will soon support multiple DB drivers, and I'll work on making adding new ones relatively straightforward.

Re: Mastering Nim – now available on Amazon

#102
post #55

Earlier quoted context omitted.

Care to give a brief overview of what you find appealing? I've never looked into the language before.

I particularly like, from the syntax side: - Python-style syntax with significant indentation - Uniform Function Call Syntax: a.len() == a.len == len(a) - Fully unqualified imports by default: which might seem scary to Python programmers, but works great in practice because of static typing - All of the above makes code readable and succinct And from a language features side: - Compiles to C with all the architectura…

One really important thing I forgot to mention is how extendable Nim is - first class support for macros and AST manipulation is very powerful. This cuts back significantly on the amount of functionality that needs compiler magic.

So you'll see alternative (or new) implementations of core language features like async, threading, DSLs, typeclasses, traits, etc available as external packages, with just about the same user experience as if they were built into the stdlib or compiler.

Re: Mastering Nim – now available on Amazon

#103

Earlier quoted context omitted.

It is. Ruby and python are in the same class despite python being more data oriented. Julia is the same thing. Data oriented.

Ruby and Python aren't data oriented. Python specifically was designed and used as system scripting language and Ruby was designed as an improved Python. Python only came to be used for analytics (as well as web and app development) because people made libraries for it. It could have been another language. Nim and Crystal could be utilized to write the underlying libraries (being performant static languages) but it w…

Python is data oriented. Nobody is talking about origins of programming languages. That is a separate topic. We are talking about the language as it stands now based on how it's used and the ecosystem.

I never said Ruby was data oriented.

Re: Mastering Nim – now available on Amazon

#104
post #100

Earlier quoted context omitted.

I went with db_postgres as well. Unfortunately, it is not async. I did consider treeform's pg, but unfortunately i did not get any reply from him on my question so decided not to go with it for the TE benchmarks. I think the lowest hanging fruit for db drivers would be to just wrap libpq, the default PG driver. Given Nim's c interop, that should be easy. I was planning to do that, but then life happened and I had to…

I agree that wrapping libpq sounds like a good idea.

did a bit more digging and apparantly db_postgres wraps libpq already. So either nim is still using a very old version of libpq or it was never updated to use the async apis.

Re: Mastering Nim – now available on Amazon

#105

Earlier quoted context omitted.

I'm assuming this must be for huge projects? I just compiled my toy project (detecting anomalous parity in integers) in nim 1.6.6 (4.23s), go 1.17.7 (2.43s to create both aarch64 and x86_64 binaries), zig 0.8.0-dev.1140 (2.04s to create aarch64 and x86_64 binaries) and C via clang 13.1.6 (0.14s). nim's compilation is 175% of Go, 207% of zig, and 3021% of clang.

how are u compiling (optimization, custom compilation flags etc.?) In my case https://github.com/mratsim/Arraymancer big project compile under your 4.2s so or you have like 10k+ lines of codes with macros or you just pass some debug flags to compiler :D

Compilation command is:

    nim c -d:release --passC:"-flto" --gc:markAndSweep --out:ap ap.nim
I will add that once it's been run a few times, it does go a bit quicker (down to ~0.7s) but the Go also gets quicker (down to 0.28s for two outputs when files are cached.)

Re: Mastering Nim – now available on Amazon

#106
post #72
post #67

Earlier quoted context omitted.

I love nim, but I disagree with the "quick compilation" point here. The compilation is horrendously slow. (by default it compiles down to C, then to exe from there).

It's much faster than C++, Rust, Go and many others.

No, it is not - Nim's compiler backend is extremely complex and full of cruft. I've been around Nim for 7+ years now and there's a reason the compiler was hard forked.

Nim's compiler is definitely not speedy, and this is why so much effort has been spent on incremental compilation, which tmk, still isn't working - https://github.com/nim-lang/Nim/issues/19757.

Post reply on HN