HN2new | past | comments | ask | show | jobs | submitlogin

I wish the article would also mention Nim, a Python-like language that compiles to native, and compare it to Mojo.

Also, this isn't quite correct:

> There is also the approach taken by Go, which isn’t able to generate small applications like C, but instead incorporates a “runtime” into each packaged application. This approach is a compromise between Python and C, still requiring tens of megabytes for a binary, but providing for easier deployment than Python.

Compiling Go with gccgo instead of the Go compiler, and with the right flags, results in a much smaller executable.

It is also possible to further compress the executable with upx.

This command should result in executables around 0.5 to 1.5 MiB in size, on Linux (depending on the size of the Go project):

    go build -mod=vendor -gccgoflags '-Os -s' -o prog && upx --best --lzma prog


> I wish the article would also mention Nim, a Python-like language that compiles to native, and compare it to Mojo.

I would not say that Nim is “a Python-like language”. The only significant similarity is in the usage of indentation instead of curly brackets. To me, it is much more similar to Pascal/Ada/Oberon, but less verbose.


I have not programmed much in Nim, and I think you are mostly right, but Nim also have keywords and concepts not found in Pascal/Ada/Oberon that clearly comes from Python, like "yield" and iterators:

    iterator iota(n: int): int =
      for i in 0..<n: yield i


I think the 1977 Icon language is where the generator concept originated. It had many other cool features I have not seen in other languages since: https://en.wikipedia.org/wiki/Icon_(programming_language)#




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: