Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
arc776
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
11 ms
·
31.
▲
by
arc776
5y ago
What things do you wish for in Nim from Rust?
32.
▲
by
arc776
5y ago
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: - enumuti
33.
▲
by
arc776
5y ago
> it is a garbage collected language GC has to be explicitly attached to types . By default everything is a value type allocated on the stack, and managed by scope. Nim is also clever enough to optimise away copies for value types (such
34.
▲
by
arc776
5y ago
Nim has a popular ML library "inspired by Numpy and PyTorch": https://github.com/mratsim/Arraymancer One of the advantages of the language for DS/ML is the native "C like" performance with very
35.
▲
by
arc776
5y ago
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 depe
36.
▲
by
arc776
5y ago
> shoving all your data into and out of boxes that don't fit Ironically this is what dynamic languages do. Everything is in boxes that could be anything. It's worth bearing in mind that dynamic languages can be (and often are)
37.
▲
by
arc776
5y ago
Why do you want to have a static type for each combination of fields in a query? There's no need to do this. > I WISH there was a dynamic language that would statically type your attributes, that would be the perfect hybrid for me.
38.
▲
by
arc776
6y ago
Fair enough, I feel like some antialiasing on the fonts would make it look a lot nicer.
39.
▲
by
arc776
6y ago
Of course bigints require more than one instruction to add them, but even then you can reduce the work at compile time down to a series of integer operations, whereas the above code requires interpretting the program before it even gets to
40.
▲
by
arc776
6y ago
Ah, that's a good point. It would be interesting to see fairer benchmarks for TruffleRuby after reading about some of the optimisations they're able to make.
41.
▲
by
arc776
6y ago
Thanks for the links. Very interesting to read how you get around these tricky dynamic operations! > get threads that want to monkey patch to stop other threads and tell them to start checking for redefined methods As an aside, this sort
42.
▲
by
arc776
6y ago
> Can you give specific examples and prove that they cannot be overcome? It's hard to prove a theoretical negative, but perhaps by comparison with the run time performance of static AOT (SAOT) compiled languages I can show what I me
43.
▲
by
arc776
6y ago
> I'd challenge the idea that there really are known 'limits'. There are good reasons why these limits cannot be overcome in that the complexity and dynamism of the language precludes it. Being interpreted is one cost that
44.
▲
by
arc776
6y ago
I'm not familiar with Ruby, but it doesn't seem like TruffleRuby is really competitive with languages known for performance. These are only simple benchmarks, but do indicate a rough ballpark for TruffleRuby: https://gi
45.
▲
by
arc776
6y ago
As the OP states: > mutable interpreter frames, global interpreter locks, shared global state, type slots On top of this, Python is extremely dynamic and nothing can be assured without running through the code. So this leads to needing J
46.
▲
by
arc776
6y ago
Just want to say thanks for these links, very interesting so far. A point made in the video that seems to highlight the issue: > Just adding two numbers requires 400 lines of code. In compiled languages, this is one instruction! Think ab
47.
▲
by
arc776
6y ago
The thing about Javascript is it's actually a very simple language. You can make a lot of guarantees and this means performance patterns can be implied. Ultimately JS can be reduced to a very tight engine. This is not possible with Pyt
48.
▲
by
arc776
6y ago
I completely agree. Everything is baked in to be slow. There is no way around it, I don't think you can write super fast interpreters like with Javascript - I might be wrong, but so far it hasn't happened. For general use cases th
49.
▲
by
arc776
6y ago
I gave up trying to make Python fast since to do so you give up what makes Python good and end up writing C/Cython. On top of this, distributing Python is just... gross, at least for my use cases. Eventually I found Nim and never looke
50.
▲
by
arc776
6y ago
Regarding GUI, there is also https://github.com/yglukhov/nimx which is based on OpenGL. > Nimx officially supports Linux, MacOS, Windows, Android, iOS, Javascript (with Nim JS backend) and Asm.js/WebAssembly (w
51.
▲
by
arc776
6y ago
Another reason: compile times are super fast compared to Rust and C++ even with lots of metaprogramming.
52.
▲
by
arc776
6y ago
Yeah I should have stressed that it's just the productivity that matches Python, not the operation. As you say it's similarity is only skin deep with significant whitespace. In terms of use I find it feels a lot like a better Pasc
53.
▲
by
arc776
6y ago
Nim is strongly, statically typed. It's very type safe. Nim being able to compile to Javascript and, say, C means you can write your server and web client in the same language. This means you can share code between client and server wh
54.
▲
by
arc776
6y ago
> I've had my share of burnouts because of its lack of types and difficulties in refactoring big code-bases. Nim is strongly, statically typed. Also, I agree and aside from performance it's why I started using Nim instead of Py
55.
▲
by
arc776
6y ago
Whilst there is a pretty well fleshed out stdlib, since Nim can compile to C, C++, Javascript, and even LLVM, you can use any library written for those languages/platforms. That's a huge mass of ecosystems that are natively access
56.
▲
by
arc776
6y ago
I would say one of Nim's biggest strengths is the productivity of Python with the performance of C; it feels like scripting, but you have production ready performance. Another productivity benefit is compiling to C, C++, and Javascript
57.
▲
by
arc776
6y ago
> the tradeoffs of ORC and availability of manual memory management For those not familiar with the language, Nim only uses GC for `seq` (dynamically sized lists like c++ vectors), `string`, and types declared with `ref`. Everything else
58.
▲
by
arc776
6y ago
Network protocol stuff, database tools, web clients & servers, games, graphics, AI, cryptography, and various random projects over the past 5-6 years. Some professionally, some for fun. It's an incredibly adaptable tool. I mean, ju
59.
▲
by
arc776
6y ago
You generally want to use the simplest tool for the job first. Most of the time generics and templates really are as much as you need since Nim's generics are structurally typed and templates allow a lot of metaprogramming without gett
60.
▲
by
arc776
6y ago
> Nim on the surface has a dream set of features It's "too good to be true" is for real. The lack of friction when developing in Nim is what makes it so fun to code in (IMO). Metaprogramming in particular is just great in
More ›