NPainter will not be written in Nim anymore, i will rewrite Nim parts of the program in C and use Haxe HashLink for user interface programming.
This plan looks quite strange but it will make life easier and make it has a future-proof development, also Haxe aligns with the gui toolkit paradigm that could not be fully implemented due some Nim design flaws
@mrgaturus huh! this kinda reminds of the thing AzPainter did with its own mlk gui toolkit
it seems like that worked really well for azel!
good luck with the rewrite~ ^^
@archenoth i pushed Nim to it's limits, aside the ui/ux is now messy due some Nim design flaws i'm also getting so much slow compile times .
i've looking Haxe in the real world for some time and it's very amazing, the runtime idea for ui/ux was inspired by how Blender is made having the logic and gui toolkit written in C/C++ but the ui/ux written in Python. Haxe HashLink VM is very small that fits my needs for still having a tiny binary
@ITwrx first, this now make a lot sense for me: https://news.ycombinator.com/item?id=31280972
Now my opinions
- NPainter is now a huge project (110 nogui files, 123 npainter files), 60% is now written in C to overcoming Nim limitations and annoyances
- upcoming nimony/nim 3 is going to break many unsafe tricks which are super important for both nogui and npainter so it could be semi rewrite but adding more safe boilerplate everywhere and the new macro system could lack macrocache variables
@ITwrx
- I have huge plans for Android/iPad in a future and Nim doesn't support those platforms, I'm having some issues with Clang (bucket fill crashes in clang but not gcc and the culprit is nim)
The most important
- I'm now needing true object oriented programming for UI/UX programming, my macros tries simulate it, they are so hacky that in big scale it's starting being super annoying
NPainter is now stuck if there is not another nogui overhaul and it's the perfect opportunity to ditch Nim
@ITwrx i will not use Haxe Java, the Haxe HashLink runtime is written in C that can also be compiled for NDK and iOS/iPad OS
@ITwrx @mrgaturus ooh! fun fact! while android apps aaaare typically written with java or kotlin for their actual user-facing stuff, you can actually just have 99% of your code be in a language that complies to an ELF for the architecture of the phones you wanna support!
that's why you can run most nongraphical aarch64 statically linked linux binaries (for example, a lot of things written in go!) on android phones without needing to modify them if you have access to a terminal
that means npainter doesn't need to be totally rewritten in another language for an android port--just a frontend would~
@archenoth @ITwrx The program will have the same code for all platforms, i just need add native platform support to my gui toolkit (maybe a SDL3 backend for Android/iOS).
The problem was Nim which it's runtime seems to be very incompatible with mobile (imagine issues of GLib).
Also for mobile i'm thinking for a home frontend to properly manage drawings, permissions and have integration with Google Drive without doing that in C/C++.
You can embed a SDL3 application in a Android/iOS component
@ITwrx the code written in C as today is due:
- SIMD code is not good in Nim, the generated C code may break unrolling momentum and confuse the optimizer due massive usage of redundant temporals
- Pixel processing is a lot better with pointer arithmetic
- Nim always assumes every to float and int so it doesn't respect small types like int16, int32, so you need explicit conversions even for a 0 int literal
- X11 and Win32 bindings are awful so the usage is written in C and exported to Nim
@ITwrx sadly no but treeform and guzba stuff convinced me to use Nim. I can't deny Nim played a huge role for the project being the incubator and also made me gain many programming skills
@ITwrx i wrote my own libraries from scratch and almost to ditch nimble and use nim command directly (but i ended up ditching nim )
if you want you can check out how was my gui tookit in nim, the test folder includes some examples and npainter was the big cake.
the final thing i did for Nim was green threads coroutines with an easy usage (check test/tasync_coro.nim)
@mrgaturus looking forward to the next version :)