Nim: new compilation target - Nim to python

Created on 19 Oct 2017  路  4Comments  路  Source: nim-lang/Nim

Nim already compiles to C,C++ or javascript
*I request to kindly make a compilation target Python (Nim source code compiling to pure python source code) *
It will push Nim to mainstream usage in datascience, where only Python and R are contendors of the top slot ( see https://www.infoworld.com/article/3187550/data-science/python-vs-r-the-battle-for-data-scientist-mind-share.html ) . By Nim to python compilation target we will be able to access numpy, matplotlib,pandas etc awesome libraries. This will fit Nim into those teams - where Python is being used

If later i just want to do nim programs without these numpy etc library access, then i can just compile it to native binary without requiring python runtime, , by using nim to C compilation target.

So single programming language will be suffice to do - native binary generation and also python runtime too

Codegen Feature RFC

Most helpful comment

@zaxebo1 - if reaching the maximum amount of targets, or especially Python is a priority, you may be better served by the Haxe programming language:

https://haxe.org/documentation/introduction/compiler-targets.html

Or alternatively, the Rusthon project:

https://github.com/rusthon/Rusthon

Nim's super awesome, but using it's C FFI ability (eg, with something like pymod) is probably your best bet. eg, that's also how Chucklefish is able to use Rust (and not something like Haxe) to target a very large number of consoles for their upcoming Spellbound game.

All 4 comments

Yeah ... not gonna happen. Every backend is a big maintenance burden. You're better off compiling your Nim code to a DLL that Python can load or to use interprocess communications or to use the Python API to embed Python into Nim.

@zaxebo1 why would you use Nim over Python then?
Python doesn't offer anything which can be useful for Nim (and Python is even slower than JS)
Nim has JS target only because it's a mainstream web language.

@zaxebo1 - if reaching the maximum amount of targets, or especially Python is a priority, you may be better served by the Haxe programming language:

https://haxe.org/documentation/introduction/compiler-targets.html

Or alternatively, the Rusthon project:

https://github.com/rusthon/Rusthon

Nim's super awesome, but using it's C FFI ability (eg, with something like pymod) is probably your best bet. eg, that's also how Chucklefish is able to use Rust (and not something like Haxe) to target a very large number of consoles for their upcoming Spellbound game.

@wizzardx
okk.
Thanks :-)

Was this page helpful?
0 / 5 - 0 ratings