31 ms·
Nim 1.6
- DeathArrow 5y ago>Nim made its first entry in TIOBE index in 2017 at position 129, last year it entered the top-100, and for 2 months the top-50 (link). We hope this release will reinforce this trend, building on Nim’s core strengths: I wonder if it has chances to ever enter top 20.
- indymike 5y agoIt does, with the right libraries. I started a product last year in Go. If I had done so this year, it would have been with Nim. It's a really interesting language.
- adgjlsfhk1 5y agowhy use tiobe when it is so clearly a bad metric? Pypl or the ieee index are much more reliable.
- pietroppeter 5y agowell, because Nim is neither in Pypl [1] nor in ieee index [2] yet... :) [1]: https://pypl.github.io/PYPL.html https://pypl.github.io/PYPL.html [2]: https://spectrum.ieee.org/top-programming-languages/ https://spectrum.ieee.org/top-programming-languages/
- hota_mazi 5y agoNot sure why you say these are much better when all these surveys pretty much give you the same result, if you look at these rankings in terms of brackets. Basically, they pretty much all agree which languages are the top 3, top 5, top 10, etc...
- adgjlsfhk1 5y agoTiobe ranks based on search results rather than visits, so languages can be ranked highly due to old computer generated docs that no one has ever read. Furthermore, tiobe only searches "x programming" which biases towards some languages and against others (Go and Julia come to mind as ones that are refereed to as Golang and Julialang frequently). Also, although the general results TIOBE gives look roughly accurate there are some entries that are wrong enough that you should question the validity of the ranking as a whole. For example, TIOBE ranks "Classic Visual Basic" as the 11th most popular language and claims that it has climbed 8 ranks in 2020. Given that the language hasn't been supported since 2008, and I have never heard of anyone using it for anything, that is rather surprising. Similarly, Tiobe appears to believe that Visual Basic is more popular than Javascipt which is frankly not credible (for refferrence, PYPL and IEEE place it at a much more believable 18th and 22nd).
- mrath 5y agoI don’t know much about Nim, does it have a mandatory gc, like go? How good is Nim’s gc? Those who have written some Go and Nim, home does the code look like vs go?
- BiteCode_dev 5y agoAs a python dev, nim was much easier to get into than Go, Rust, or even Zig. If you squint, it looks like a toddler Python with strong typing, compilation and a few different API, espacially for managing finalisation.
- ijlx 5y agoI may be splitting hairs here but Python is actually a strongly typed language. It would be better to say nim has static typing: https://wiki.python.org/moin/Why%20is%20Python%20a%20dynamic%20language%20and%20also%20a%20strongly%20typed%20language https://wiki.python.org/moin/Why%20is%20Python%20a%20dynamic...
- sp33der89 5y agoNim is the most readable language I've ever seen. I've dabbled with Go, but Nim is almost like pseudocodes+types. Highly recommend you take a look and try it out! You can use libraries like https://github.com/planety/prologue https://github.com/planety/prologue or https://github.com/treeform/pixie https://github.com/treeform/pixie to create something quickly and fun(compile times are faaasst!). And Nim does not have a mandatory GC, you can go as low-level as you want, but in case you don't want that you can choose from several great GC's(a capable soft real-time GC and Boehm for example). Or you could combine the best of both worlds and take a look at the shiny fancy ARC/ORC deterministic memory management: https://nim-lang.org/blog/2020/10/15/introduction-to-arc-orc-in-nim.html https://nim-lang.org/blog/2020/10/15/introduction-to-arc-orc...
- mrath 5y agoLooks like you know a bit of Nim. Apart from ecosystem and IDE what are the some of the disadvantages of Nim compared to Go?
- turminal 5y ago> 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".
- sp33der89 5y agoWell 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 https://github.com/Vindaar/shell * Frontend: https://github.com/karaxnim/karax https://github.com/karaxnim/karax or you could bind to an existing JS library. * Backend: For something Flask-like: https://github.com/dom96/jester https://github.com/dom96/jester or something with more defaults https://github.com/planety/prologue https://github.com/planety/prologue * Scientific computing: the wonderful SciNim https://github.com/SciNim https://github.com/SciNim * Blockchain: Status has some of the biggest Nim codebases currently in production https://github.com/status-im?q=&type=&language=nim&sort= https://github.com/status-im?q=&type=&language=nim&sort= * Gamedev: Also used in production: https://github.com/pragmagic/godot-nim https://github.com/pragmagic/godot-nim and due to easy C and C++ interop, you get access to a lot of gamedev libraries! * Embedded: this is a domain I know very little about but for example https://github.com/elcritch/nesper https://github.com/elcritch/nesper or https://github.com/PMunch/badger https://github.com/PMunch/badger for fun Nim+embedded stuff! Most of the disadvantages come from tooling and lack of $$$ support.
- tyingq 5y agoI 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.
- dom96 5y agoYeah, 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 :)
- xet7 5y agoHow to run those benchmarks? At that Nim release page: https://nim-lang.org/blog/2021/10/19/version-160-released.html https://nim-lang.org/blog/2021/10/19/version-160-released.ht... Is link to this benchmark: https://web-frameworks-benchmark.netlify.app/result 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 https://github.com/dom96/httpbeast That says it would be more useful to use jester: https://github.com/dom96/jester https://github.com/dom96/jester Jester has 150k req/s. But, when looking at these: https://www.techempower.com/benchmarks/ https://www.techempower.com/benchmarks/ drogon, actix etc has about 600k req/s . Also redbean has about 600k req/s, when I tested: https://redbean.dev/ https://redbean.dev/ I tested like this: git clone https://github.com/wg/wrk.git https://github.com/wg/wrk.git cd wrk make ./wrk -H 'Accept-Encoding: gzip' -t 12 -c 120 http://127.0.0.1:8080/ http://127.0.0.1:8080/ When I tested https://caddyserver.com https://caddyserver.com v2, it did show about 800k req/s. It would be very helpful to know how those benchmarks are actually done, so that I could compare what is actually fastest in real world, and not just use some for benchmark tested winning non-realistic code.
- sp33der89 5y agoThe source code for the benchmarks is here: https://github.com/the-benchmarker/web-frameworks https://github.com/the-benchmarker/web-frameworks And the httpbeast code is here: https://github.com/the-benchmarker/web-frameworks/tree/master/nim/httpbeast https://github.com/the-benchmarker/web-frameworks/tree/maste... TechEmpower and TheBenchmarker are 2 different benchmarks and I'm not sure how they compare. Besides that benchmarks rarely benchmark realistic code and the Nim blog doesn't mention being the fastest out there, but it mentions "native performance" which I feel like is a fair claim.
- dom96 5y agoYou definitely cannot compare a benchmark result you got on your machine vs. one in (what I believe is) a CI environment.
- vyuh 5y ago> Fast compile times: a full compiler rebuild takes ~12s (Rust: 15min, gcc: 30min+, clang: 1hr+, Go: 90s) [2]. Whoa, this really surprised me!
- lifthrasiir 5y agoDoesn'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.
- xigoi 5y agoThe Nim compiler is pretty big.
- lifthrasiir 5y agoSo what? You are not comparing the same thing.
- xigoi 5y agoOf course not. But what else would you want to compare?
- lifthrasiir 5y agoLines of code per second for compiling the compiler. Or a standardized set of programs like language benchmark game. Not to say that they are not susceptible to problems, but they have much more information than the compiler compilation speed.
- wiremine 5y agoI learned Nim last year by rewriting some of the core Arduino functionality in C, and then wrapping them in Nim. (I also wanted to better learn C and better understand how Arduino's internals work, thus the convoluted approach) A few observations: * The community was very helpful and responsive. I identified a bug in compiling Nim to bare metal C, and it was fixed in 24 hours. * The C/Nim bindings were a breeze to use, even for a relatively novice C programmer like myself. * The language is fairly sparse, in a good way. It feels a bit like Go in that regard, but with better metaprogramming support. * I personally like meaningful, Python-style whitespace, but I could see how that could be a turnoff. But I'd hope people can look beyond that and give the language a try. * I could _actually_ use Nim to write code for an Arduino Uno, so the project was a success. The firmware sizes weren't that bad, either, which was my biggest concern. Nim's memory management is very flexible, and the ARC system seemed to work great without the need for GC. [1] [1] https://nim-lang.org/blog/2020/10/15/introduction-to-arc-orc-in-nim.html https://nim-lang.org/blog/2020/10/15/introduction-to-arc-orc...
- PMunch 5y agoOh it definitely can run on those devices! I wrote my own keyboard firmware from scratch in Nim, and the firmware sizes are vanishingly small compared to even simple "hello world" level stuff in Arduino. I did a talk on it for NimConf2021: https://www.youtube.com/watch?v=dcHEhO4J29U https://www.youtube.com/watch?v=dcHEhO4J29U
- wiremine 5y agoThis is great! I've wondered if Nim could be the foundation for a sort of "next-generation" Arduino. It's easy to learn, compiles to small binaries, and can wrap a ton of existing C code. My experiments taught me wrapping Arduino from scratch, while possible, might not be ideal. There's some cruft in that code base, and the abstractions could use some updating.
- dom96 5y agoThere is definitely room for this, it just needs somebody passionate enough to write a nice Arduino/embedded framework and document/promote it well.
- guggle 5y agoWhat'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)
- Arch-TK 5y agoWhy use an ORM when you can just not turn everything into objects?
- dom96 5y agoThere 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 https://github.com/dom96/jester 1 - https://github.com/dom96/httpbeast https://github.com/dom96/httpbeast
- guggle 5y agoThanks ! I see jesper's Request has its body as a string. How would you manage (very) large request body ?
- moigagoo 5y agoIn the ORM field, Norm[1] is an actively maintained package that supports SQLite and Postgres (shameless plug). It's framework agnostic, I've used it with Jester and Prologue (it had nothing to do with Prolog btw). Among frameworks, Prologue is the most actively developed and feature rich. [1] https://norm.nim.town https://norm.nim.town
- akovaski 5y agoI 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?
- haxscramper 5y agoNo, never. Actually the most problem I've ever had with this feature is seemingly unending discussions that come up in almost every single HN discussion ever, like https://news.ycombinator.com/item?id=28651040 https://news.ycombinator.com/item?id=28651040 > would make grepping harder on larger projects There is a built-in tool `nimgrep`, but honestly I never even need for that - `rg` worked perfectly fine each time I had to do something like that.
- mst 5y agoWithin a specific project, you pick an approach and stick to it, just like you should do for any given convention within a project. The idea is to make it easier for projects using different conventions to be built on top of each other without making things harder to read - and in practice it actually works really well at that. On the upside, people freaking out over the style insensitivity makes for a nice change from people freaking out over nim caring about whitespace, so at least we get some variety in our aesthetic worrying from people who've not had time to try the language yet :D
- akovaski 5y agoHa, I wouldn't have thought to criticize the spacing, but I did see one person complain as I explored old Nim discussions. Nim being strict on tabs is something I see as a good feature for the same reason the style flexibility made me instinctively flinch back. I've experienced mixed tabs and spaces in Python code and I do not like it; the flexibility leads to inconsistency.
- mst 5y ago
- barelysapient 5y agoMaybe a year and a half ago I put myself towards learning Nim. My learning project was a basic REST API backend written using the standard library. I found the lack of IDE support very painful. On top of that, I ran into places where the documentation was out of date or just incorrect. After a few weeks of painful, slow going, I turned my attention to GO instead and haven't looked back.
- v3ss0n 5y agoi think that is over 2-3 years ago , Since nim 1.x documentation is fine , and vscode plugins are out. It your time to look back now , a lot more stable and complete.
- barelysapient 5y agoCool, I'll give it another shot.
- MR4D 5y agoI see 2 targets that Nim could attack well with a bit of focus - Python and Swift. Both have their strengths, but you always pick off people at the edges. Performance would do well against Python, and multi-platform against Swift. This will be an interesting space to watch. If a beautifulsoup equivalent existed, I would put some serious time into it and reduce my Python time (but that’s just my need).
- MR4D 5y agoOne thing I think would be interesting - get listed on Computer Benchmarks Game.
- dom96 5y agoIt would be interesting, yes, but the maintainers of that have explicitly refused to add Nim (and other "new" languages).
- MR4D 5y agoAh - I wasn't aware of that. That sucks.
- igouy 5y agoTry https://programming-language-benchmarks.vercel.app https://programming-language-benchmarks.vercel.app
- igouy 5y agoThink of it as an opportunity for you to publish the measurements you make! https://benchmarksgame-team.pages.debian.net/benchmarksgame/sometimes-people-just-make-up-stuff.html#maintenance-burden https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
- dom96 5y agoInstead of beautifulsoup you're honestly better off just running an instance of Firefox/Chrome and scraping data that way. You can do fairly easily these days and I have a library that allows you to do so in Nim: https://github.com/dom96/webdriver https://github.com/dom96/webdriver
- iffycan 5y agoNim has been such a fun language to use. I make a money-earning desktop application (Electron for the GUI and Nim for the core logic) and companion web service (fully Nim). It has been a pleasure using Nim to make these and other things. Congrats, Nim team!
- sausage_dog 5y agoI would love to see this, what's the product?
- pietroppeter 5y agohttps://www.budgetwithbuckets.com/ https://www.budgetwithbuckets.com/
- plainOldText 5y agoI 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 reference, I mostly write web apps in Elixir, but I needed another language in my toolbox that is statically compiled and lightweight. I looked at Rust, Nim and Crystal. I ended up choosing Nim, because Rust is too complex for my taste, and Crystal’s syntax resembles Elixir (they both drew inspiration from Ruby) and it would be confusing when switching between the two languages. Ultimately, they’re all cool, modern languages, so pick whatever fits your brain and helps you reach your objectives easier, while engaging in this social (or solitary) activity called programming.
- sp33der89 5y ago> Ultimately, they’re all cool, modern languages, so pick whatever fits your brain and helps you reach your objectives easier, while engaging in this social (or solitary) activity called programming. Extremely, extremely true!
- elcritch 5y agoHave you tried Nimler? It’s pretty nice! I haven’t used it for a year or so.
- plainOldText 5y agoWell, I wanted to try Nimler (as an alternative to Rustler) but I couldn’t get it to compile on my Mac. Something about some missing symbols if I remember correctly. I’ll have to investigate deeper when I have the time, as it seems quite appealing to be able to rewrite the slower Elixir parts in Nim.
- elcritch 5y agoOdd, but hopefully fixed. The ability to add "noexceptions" annotation to ensure you handle any possible exceptions and avoid killing beam is awesome.
- sergiotapia 5y agoNim needs that one killer framework and it's off to the races. A Rails or a Phoenix, batteries/ORM included for Nim. Imagine running a very scalable, productive project on peanuts hardware with very fast performance. Killer.
- GordonS 5y agoAre there any capable IDEs for Nim? I'm thinking something along the lines of what GoLand is for Go, or Rider is for C# - a fully-featured IntelliJ kind of IDE. I'd be much more inclined to kick Nim's tyres if there is a good IDE.
- auxym 5y agoI believe the best experience ATM is with VSCode and the nim plugin. It's not perfect, but th community is aware and there is work underway to improve tooling: https://github.com/nim-lang/RFCs/issues/300 https://github.com/nim-lang/RFCs/issues/300
- arc776 5y agoThe full changelog is here: https://github.com/nim-lang/Nim/blob/version-1-6/changelogs/changelog_1_6_0.md 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 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.
- v3ss0n 5y agoTo all those wondering about IDE support , the actively maintained VSCode extension is : https://github.com/saem/vscode-nim https://github.com/saem/vscode-nim The default extension suggested by VSCode which have over 43k downloads in un-maintained for Eons and it won't work. Here is the link : https://marketplace.visualstudio.com/items?itemName=nimsaem.nimvscode https://marketplace.visualstudio.com/items?itemName=nimsaem.... This extension works properly , go-to definations too. Nim need contributors on VSCode and other extensions part , and the language server which is in active development : https://github.com/PMunch/nimlsp https://github.com/PMunch/nimlsp @dom96 can you pin this somewhere on the forum or website ?
- Arch-TK 5y agoFor anyone put off by nim's copious use of camelCase and PascalCase, I recently learned that nim treats identifiers as the same if after removing all underscores the identifiers compare equal case-insensitively (except for the first character which is case sensitive). This means you can completely ignore NEP 1 (just like you can ignore PEP 8) and write your code with snake_case identifiers and Upper_snake_case types including any calls to external code. This means that for people like me who find camelCase horribly ugly and refuse to casually use any language which uses it in its standard libraries or syntax (I'm looking at you haskell and zig) you can write code in a more aesthetically pleasing way while everyone else around you can continue using the horrific camelCase names (even when referring to your snake_case code). Also, I highly recommend switching to at least 3 space indents so that unlike regex your code stops being write-only.