pixie
karax
Our great sponsors
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
pixie
-
Nim v2.0 Released
We have written pixie: https://github.com/treeform/pixie . Pixie is a 2D graphics library similar to Cairo and Skia written entirely in Nim. Which I think is a big accomplishment. It even has python bindings: https://pypi.org/project/pixie-python/
- How can I add graphics to my nim program?
-
Simple Gamepad Support
I made it because I really like pixie/boxy/windy combo, but there is no gamepad support built-in.
-
Why I enjoy using the Nim programming language at Reddit.
With Nim, you can continuously optimize and improve the hot spots in your code. For example, in the Pixie graphics library, path filling started with floating point code, switched to floating point SIMD, then to 16-bit integer SIMD. Finally, this SIMD was written for both x86 and ARM.
-
Is Fidget usable for implementation of 3D rendering?
The author Fidget actually has a number of other great libraries that are part of the rendering stack. Notably, Pixie for text and shape rendering in 2D, Boxy for rendering textures to the GPU via opengl, and then Windy for an OS window context and user events, and a number of other libraries related to 3D rendering.
-
Ask HN: What's the best source code you've read?
Perhaps not the "best" source code I've ever read, but libVF.io had some beautiful code for what's generally gnarly system-glue code. The iommu setup code is a good example and inspires me to think that system-glue code doesn't need to be gross or impenetrable: https://github.com/Arc-Compute/LibVF.IO/blob/master/src/libv...
Another one I've appreciated reading (and learned more about 2d graphics from) is Pixie, a 2d graphics library written in Nim. Here's the implementation of a fair subset of SVG paths: https://github.com/treeform/pixie/blob/master/src/pixie/path...
And one last one for basic algorithms: https://github.com/nim-lang/Nim/blob/version-1-6/lib/pure/al...
Of course Knuth's original code is still some of the best classic code. K&R's original C book is a classic.
-
Nim: Curated Packages
I am working on OpenStreetMap renderer in Nim - see https://github.com/severak/lunarender3/ (but work somewhat stalled)
I needed some language which is:
- compiled to binaries
- and really fast
- has needed libraries (HTTP server, protocol buffers, sqlite and image generation)
- it's easy to set up
It was nice experience and Nim simply worked for my needs. People on Nim forum were nice and helped me when I ran into problems. It has nice and usable built-in library and I was really impressed by graphic library pixie - https://github.com/treeform/pixie
I would use Nim again when I when I will see this application is suited for it (e.g. some command line apps).
-
Building a simple room-based chat application in Nim (using HTMX)
> but not so small that there are no useful libraries written...
Says the person responsible for a ton of really useful, well-done Nim libraries, such as this amazing Cairo/Skia-like library: https://github.com/treeform/pixie#readme
Thank you for all the things you've made for Nim!
-
What sort of mature, open-source libraries do you feel Rust should have but currently lacks?
A 2d graphics library like Nim’s pixie
-
Nim Version 1.6 Released
Nim is the most readable language I've ever seen. I've dabbled with Go, but Nim is almost like pseudocodes+types. Highly recommend you take a like, try it out! You can use libraries like https://github.com/planety/prologue or https://github.com/treeform/pixie to create something quickly and fun(compile times are faaasst!).
And Nim does not have a mandatory GC, you can go as low-level as you want, but in case you don't want that you can choose from several great GC's(a capable soft real-time GC and Boehm for example).
karax
-
Nitter (Twitter front end) is working again
The frontend uses Karax, which is my favorite frontend/SPA library. It is an absolute joy to use, even if it's a bit rough around the edges.
-
I learned 7 programming languages so you don't have to
I have used Nim for personal projects for 6 years now and it continues to surprise me on how well versed it is for many problem domains. I am fond of it's SPA framework, karax https://github.com/karaxnim/karax for which I wrote a translation utility https://github.com/nim-lang-cn/html2karax Latest Nimv2 release candidate has improved in the ergonomics and syntax that affect compilation to js, so I was able to cleanup my webapp's code to be less verbose. On GPU programming there has been a few projects that touch GPU programming, most notably https://github.com/treeform/shady
-
Web apps in pure Python.
And it's present not only in Python but in other languages as well. Check for example https://github.com/karaxnim/karax - I don't know why people would want to hide all of their HTML in Python/whatever language. Then limit their ability to script and style it in one way or another.
-
A Cost Model for Nim
> the real killer feature to me is the javascript target
Agree, this is amazing because you can share code and data structures between front and backend (for example: https://github.com/karaxnim/karax).
Also, it's really nice having high level stuff like metaprogramming and static typing spanning both targets. Things like reading a spec file and generating statically checked APIs for server/client is straightforward, which opens up a lot of possibilities.
-
Will Zig interop with JavaScript/Web at all?
E.g. Nim focuses on enabling what it calls "single page web apps": https://github.com/karaxnim/karax.
-
How to use JS to make a front end
I recommend you to take a look at Karax. It's a front-end framework for Nim that can compile to regular JavaScript. If you want to know how to use it with a webserver, Joker is a good example. With the Joker config, all of the compiled .js files land in /public/views, where you can take a look at them. But keep in mind that the JS that Nim produces is often rather cumbersome and hundreds of lines long, even if it's just a simple program.
-
Building a simple room-based chat application in Nim (using HTMX)
`buildHtml` is a macro, the code passed to it via it's invocation (the 'colon-delimited indented code blocks') is then transformed as explained in the readme https://github.com/karaxnim/karax#hello-world and compiled. Macros are explained in the manual https://nim-lang.github.io/Nim/manual.html#macros
The `text` function in the Karax DSL is actually escaped once it is converted to a string, see https://github.com/karaxnim/karax/blob/c71bc927494418c3f52f9... for the implementation if you are curious. There is a way to render raw HTML using `verbatim` instead of `text` in Karax.
So in this case, I believe it would be protected against XSS to some extent, but I obviously haven't done an in depth security check for a demo/simple project. There are plenty of other potential issues as well (username collisions, websocket errors, user lists) but I judged those to be out of the scope of a simple project like this.
-
Nim Version 1.6 Released
Well no language is perfect, but Nim can be used in almost every domain because of it's compilation targets(C, C++, JS) and it's fast compile times(who needs interpretation when compile times are that fast!):
* Shell scripting, I still assume most people will just use Bash tho: https://github.com/Vindaar/shell
* Frontend: https://github.com/karaxnim/karax or you could bind to an existing JS library.
* Backend: For something Flask-like: https://github.com/dom96/jester or something with more defaults https://github.com/planety/prologue
* Scientific computing: the wonderful SciNim https://github.com/SciNim
* Blockchain: Status has some of the biggest Nim codebases currently in production https://github.com/status-im?q=&type=&language=nim&sort=
* Gamedev: Also used in production: https://github.com/pragmagic/godot-nim and due to easy C and C++ interop, you get access to a lot of gamedev libraries!
* Embedded: this is a domain I know very little about but for example https://github.com/elcritch/nesper or https://github.com/PMunch/badger for fun Nim+embedded stuff!
Most of the disadvantages come from tooling and lack of $$$ support.
-
What are some simple but powerful compile-to-JS languages I might not know about, or that you are working on (not Elm, Reason, PureScript, or ClojureScript)?
I really like using Nim. It features a Python-like syntax and you can compile code to C, C++, ObjectiveC and JavaScript. If it doesn't support a certain JS feature, you can add it yourself. Due to Nim's amazing metaprogramming, you can even use it as a replacement for HTML within Karax.
What are some alternatives?
nim-chronos - Chronos - An efficient library for asynchronous programming
tiny-skia - A tiny Skia subset ported to Rust
godot-nim - Nim bindings for Godot Engine
jester - A sinatra-like web framework for Nim.
Nim - Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula. Its design focuses on efficiency, expressiveness, and elegance (in that order of priority).
happyx - Macro-oriented asynchronous web-framework written in Nim with ♥
cubiml-demo - A simple ML-like programming language with subtyping and full type inference.
vscode-nim
nlvm - LLVM-based compiler for the Nim language
raqote - Rust 2D graphics library
canvas - Cairo in Go: vector to raster, SVG, PDF, EPS, WASM, OpenGL, Gio, etc.