Live data from Hacker News

Nim – Natively compiled language with hot code-reloading at runtime [video]

youtube.com

41–50 of 118 posts

Re: Nim – Natively compiled language with hot code-reloading at runtime [video]

#41
post #26
post #18

Can someone give me some pointers to reading material on this. I'm aware of hot code reloading for interpreted languages, google just gives links to web page loading. I'm also aware of it at the OS level. I don't really understand why you'd want this in a compiled language.

If you understand why people have it in interpreted languages, why do those reasons not apply to compiled languages?

Because for an interpreted language you can use it for interactive development. I had thought different reasons would apply to a compiled language but judging by the other replies obviously not!

Re: Nim – Natively compiled language with hot code-reloading at runtime [video]

#42

Nim is an amazing language. The syntax is cleaner (IMO) and easier-to-read than Go and approaches Python in its readability, which is impressive for a statically typed, compiled language[0]. The design is focused on performance above all else, but it still has metaprogramming[1] and functional features. However, Go and other languages have a huge ecosystem and many more libraries. Nim only has a few web servers/frame…

> For HNers, it's an opportunity to still make a huge difference by contributing to a relatively young language It would be better for someone to work on an alternate, Python-like input syntax (focusing on readability and good intuition, and perhaps more attractive to novice programmers) for some established language, like Rust. Working on a "young" language, you just miss the chance of contributing to an ecosystem t…

I'd say there isn't really a better general option. Some people may want to target the largest amount of people right out of the gate, some people might want to be a big fish in a (growing) small pound. Some projects might have so many (possibly non core) dependencies that it's too hard to start from scratch without already existing mature tools, some projects you might want to start from scratch anyway so might as well use a more modern language that will give it some edge.

I think the only globally optimal option in hobby open source projects is doing whatever seems more fun for you, and for many people is using that language that no one uses (or making your own language that no one uses).

Re: Nim – Natively compiled language with hot code-reloading at runtime [video]

#43
post #40

Looks like it's still a pre-release feature at this point. Hot code-reloading part of the talk: https://youtu.be/7WgCt0Wooeo?t=1519 RFC: https://github.com/nim-lang/Nim/issues/8927 Code: https://github.com/onqtam/Nim/tree/hcr-1

> Looks like it's still a pre-release feature at this point.

It has been merged to devel branch: https://github.com/nim-lang/Nim/pull/10729

Re: Nim – Natively compiled language with hot code-reloading at runtime [video]

#44
post #29
post #15

I only skimmed the video, but I couldn't see him describing it doing type reloading. Perhaps that is what he is planning on implementing. It is very hard to implement (especially if you can't control the compiler) but very useful for general code reloading. Of course everything is relative, and even if I think it is "very hard" it might be a weekend project for someone else. Generally though, code reloading is one of…

If you put your mind to it just a bit (i.e., I wouldn't call this "automatic" exactly but it's not too hard to use the support the language, runtime, and libraries have), Erlang can even do a harder thing, which is update the code handling a given socket connection or something live, in a principled manner, while never dropping the connection. Since HTTP is transient, it's actually a bit easier than a raw socket sinc…

> Erlang can even do a harder thing, which is update the code handling a given socket connection or something live, in a principled manner, while never dropping the connection.

That's what I meant. :) Hot reloading when nothing is "in flight" isn't so hard. The Erlang the Movie example, hot-fixing a PBX without disturbing phone calls in progress (real time requirements!), is really hard.

Re: Nim – Natively compiled language with hot code-reloading at runtime [video]

#45
+1 for Nim. I'm dreaming some day to see a RAD where Lazarus generates Nim code with full LCL support; that would be a truly killer dev system for desktop apps. Lazarus is already a wonderful RAD, one can build native apps on a *PI board and run them directly on that target; Nim support would make it even greater.

Re: Nim – Natively compiled language with hot code-reloading at runtime [video]

#46
post #44
post #29

Earlier quoted context omitted.

If you put your mind to it just a bit (i.e., I wouldn't call this "automatic" exactly but it's not too hard to use the support the language, runtime, and libraries have), Erlang can even do a harder thing, which is update the code handling a given socket connection or something live, in a principled manner, while never dropping the connection. Since HTTP is transient, it's actually a bit easier than a raw socket sinc…

> Erlang can even do a harder thing, which is update the code handling a given socket connection or something live, in a principled manner, while never dropping the connection. That's what I meant. :) Hot reloading when nothing is "in flight" isn't so hard. The Erlang the Movie example, hot-fixing a PBX without disturbing phone calls in progress (real time requirements!), is really hard.

Ah, my apologies, because when you said "The holy grail of code reloading is to upgrade the code of a HTTP server while it is running and without disturbing any requests being processed." I thought you were referring to the ability of the BEAM VM to also have multiple versions of the same gen_* running, so that old requests can still be running on the original code while the new requests come in on the new code. This is in contrast to the things that came to mind like Python, which technically can replace a function reference live, but there's no such ability to partition who's in the old vs. new space like that, so it's too dangerous to be practically used (or at least not without a lot more supporting code).

BEAM's really got it all on this front.

Re: Nim – Natively compiled language with hot code-reloading at runtime [video]

#47

+1 for Nim. I'm dreaming some day to see a RAD where Lazarus generates Nim code with full LCL support; that would be a truly killer dev system for desktop apps. Lazarus is already a wonderful RAD, one can build native apps on a *PI board and run them directly on that target; Nim support would make it even greater.

Not sure what that would buy over Object Pascal and the plethora of libraries develop since Turbo Pascal/Apple Pascal days.

Re: Nim – Natively compiled language with hot code-reloading at runtime [video]

#48
post #27

Nim is an amazing language. The syntax is cleaner (IMO) and easier-to-read than Go and approaches Python in its readability, which is impressive for a statically typed, compiled language[0]. The design is focused on performance above all else, but it still has metaprogramming[1] and functional features. However, Go and other languages have a huge ecosystem and many more libraries. Nim only has a few web servers/frame…

> Until then, if you are looking for a systems programming language, you owe it to yourself to investigate Nim[3], alongside Go, Crystal, Julia, D, Rust, Haskell, etc. Go, Crystal, Julia, Haskell and Nim all have a runtime that sort of precludes their use as a true systems lang. I agree with your other points, and I like Nim, I wish it was more popular, but I can't convince myself it's worth the time investment to le…

Luckly not everyone thinks like that.

http://www.astrobe.com/default.htm

https://www.wildernesslabs.co

https://www.ptc.com/en/products/developer-tools/perc

Re: Nim – Natively compiled language with hot code-reloading at runtime [video]

#49
post #5
post #3

(Natively compiled) Erlang might want to have a word with you.

Educate me if I am wrong, but there are natively compiled Erlang modules, but no longer any natively compiled Erlang. It only runs on the BEAM, and ever since BEAM/C fell out of use in OTP R5 no native code is generated.

Native compiled modules are called NIFs or Native Implemented Functions. these are functions written in a compiled language (usually C but there are other bindings like Rust, etc.) The downside is an NIF is kind of a black box as it can't easily call back to native erlang functions without some rpc hackery. They're great if you need to do something which just returns a value. Typically, they are used for high computational speed or accessing things like hardware not available through native interfaces. See the Erlang interop page for more details: http://erlang.org/doc/tutorial/introduction.html
Post reply on HN