r/nim

▲ 34 r/nim+1 crossposts

Merenda: Pure Nim GUI toolkit based on Cocoa/OpenStep

Merenda is a new pure Nim GUI framework based on OpenStep and Cocoa with a splash of QT! It's fast, GPU rendered, with themes and look and feel along with a full suite of OpenStep/Cocoa style widgets and an accessibility layer. Support for BIDI and Harffbuzz are coming soon!

It's already implements a substantial amount of the core functionality of OpenStep and Cocoa. It's not a one-to-one implementation, but generally the APIs try to follow Cocoa's design patterns. Though cleaned up to take advantage of Nim's stronger type system than Objective-C.

For example here's the table demo showing a table view backed by a data model:

https://preview.redd.it/3fkwnmj1k7bh1.png?width=800&format=png&auto=webp&s=5868173b5ccd91c5d36c7164d500e3cb48827df0

Overall Merenda is based on several years of working on and experimenting with GUIs. I worked Figuro and was happy with many aspects of it. However the object model ran into limitations when building more complex widgets. Things like:

https://preview.redd.it/cjjq89z3l7bh1.png?width=987&format=png&auto=webp&s=1a939d0eb814befb00bc92fbf4db330659f1caf8

Merenda solves this by adopting Cocoa's dynamic methods and protocols. These are provided by Sigils. The ability for objects to adopt protocols at runtime enables implementing the rich behavior and functionality seen in Cocoa and iOS.

The implementation of this is called NimKit, mirroring Cocoa's AppKit. NimKit ships the core controls needed for desktop-style interfaces:

  • Windows and views: newApplication, sharedApplication, newWindow, newView
  • Layout and containers: newStackView, newGridView, newFormView, newSplitView, newScrollView, newTabView, newBox, newGroupBox, newSeparatorBox
  • Text: newTextField, newLabel, newTitleLabel, newStatusLabel, newTextEditor, newMonoTextEditor
  • Buttons and choices: newButton, newCheckBox, newRadioButton, newComboBox, newPopupMenuButton, newMenu, newMenuItem
  • Value and status controls: newSlider, newStepper, newSwitchButton, newProgressIndicator
  • Data and navigation views: newTableView, newOutlineView, newCascadingView, newCollectionView, newDocumentTabs, newButtonMatrix, newRadioMatrix

It's been my hobby work the last few months. I've been building and testing all of these, item by item!

Yes it's mostly built with Codex + GPT-5.5 but I continuously review the generated code and refactor and simplify it. Plus more importantly it's based on solid architectural components I've been building for years. It's definitely not what I'd call vibe coded.

https://preview.redd.it/irwz2j76l7bh1.png?width=800&format=png&auto=webp&s=408a5e7b7e3bddf2c5535fae4b85d75a07f06ea0

reddit.com
u/jjstyle99 — 2 days ago
▲ 19 r/nim

Interested in nim for game development

I am currently investigating nim for game development, having been searching for a good environment for many years. nim seems promising so far and I may use raylib bindings as my framework.

The main things that make nim appealing for game development to me are its ergonomics, unopinionated workflow, being able to shape it to my needs via macros and templates, and high performance despite resembling a scripting language. Most languages and frameworks/engines I have tried have been too rigid for the creative iterative process that game development demands, or are simply just not fun to use. Programming in my environment being fun and detached from work is my top priority.

My main concern is tooling. It was a bit of a pain to get nim set up on Windows. I am using VS Code with nimlangserver, and while it has been surprisingly solid at parsing macros it has been showing some problems. Tooltip hovering seems to just randomly stop working, and it occasionally highlights errors that aren't actually errors at all.

I would like to know what is suggested for a good tooling environment for nim. Bad tooling can undermine the semantics and power that the programming language provides.

reddit.com
u/11clock — 5 days ago
▲ 7 r/nim+1 crossposts

Released X5‑Lite: a lightweight reasoning controller for LLM agents (Lo Shu 3×3 cycle)

Hey everyone,
I’ve been experimenting with structured reasoning loops for local LLM agents and put together a small project called X5‑Lite.

It uses a simple 3×3 Lo Shu cycle as a deterministic controller to stabilize multi‑step reasoning.
The goal is to reduce chaotic drift during long chains of thought and give agents a more predictable evaluation rhythm.

It’s lightweight, backend‑agnostic, and works with any local model.

Code is here:
https://github.com/hkyuyingli-spec/X5lite (github.com in Bing)

If anyone has ideas for improving the cycle logic or integrating it with local inference pipelines, I’d love to hear your thoughts.

u/SuccessfulBand8088 — 6 days ago
▲ 12 r/nim

C GTK Libraries with Nim

Never used Nim, or developed [full applications] in a serious way.

Want to develop a native Linux application, and prefer to use GTK.

With the latest discussion around Nim and GUI libraries, I genuinely do not understand the extent of difference in hardship between using native GTK C libraries, compared to having native Nim libraries.

Even though the OCD in me cannot stand to have non-matching libraries like this, can I not get the full benefits of GTK using Nim, just by incorporating the "straight" C (whatever that means.)

Are there some examples of Nim projects or lessons that that incorporate regular C GTK libraries? Can't I get "all" of GTK this way, and do whatever I could do in a C application?

Can I plunge headlong into developing a native Linux GUI in GTK in Nim, with full expectation of being able to do anything I would have done in GTK if the application were a C application? . . . perhaps with a little extra work than if there would be for Nim-native GTK?

Is it a matter of creating personal custom "bindings" on a per-need basis?

Thanks.

reddit.com
u/robo_muse — 7 days ago