Juan Carlos
Posted on November 16, 2019
The Nim experience
So far...
When PIP3 got broken on Arch Linux,
lots of Python modules got broken,
my Nim Nimpy Python modules continue working.
When Python3 become default on most Linux,
lots of Python modules got broken,
my Nimpy Python modules continue working.
When "ABI3" of Python3 launched,
some Python modules got broken,
my Nimpy Python modules continue working.
When Python3.8 become default on Linux,
lots of Python modules got broken,
my Nimpy Python modules continue working.
"Deprecation Warning" for a year on Nimpy,
my Nimpy Python modules continue working.
"Experimental" features for a year on Nimpy,
my Nimpy Python modules continue working.
If Nimble get broken someday, just use Git or Curl,
Install packages is copy&paste a file.
My Nimpy Python modules are faster than PyPy,
the most super-optimized Python3.8 code is several orders of magnitude slower than the crappiest unoptimized equivalent on Nim.
Most times I use a lot less lines of code than CPython, without code-golf,
it is not only about more performance but also it uses less code.
C interop is a lot better than CTypes, JavaScript too,
you can interoperate with anything that has C/C++ or JS API.
I write a lot less Type Annotations thanks to Type Inference,
but yet Types are strongly enforced,
variables are not None
out of thin air, integers are not float out of thin air.
Deploy
Deploy anywhere where you can compile C:
-
scp
the binary to the server & run!, forget installers and prepared environments, those are kludges of the past.
You can learn today
Hello World:
echo "Hello World"
For Python:
import nimpy
proc hello() {.exportpy.} =
echo "Hello World"
-
{.exportpy.}
is a Pragma to export to Python, is like a Decorator. -
proc
is likedef
of Python, it also hasfunc
for Pure-Functional. - You can use Python Syntax, but for this example I go with std lib.
On Python:
from module import hello
hello()
Install, Tutorial, Documentation, Manual, Docker, Chat, Try Nim on the browser, Nim for Python devs, Standard Library, Python integration, Python Syntax, Python/Nim Cheatsheet.
Advanced Nimpy Example:
- Go give Star to Nimpy: https://github.com/yglukhov/nimpy
Welcome to the Nim
50 years on the past you can compile C,
100 years on the future you can compile C.
Dennis Ritchie was right.
👑🥰👍
Posted on November 16, 2019
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.