HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
nim-works
cps
Nim2021–2026
nim-works / cps

cps

Continuation-Passing Style for Nim 🔗

8Distinct people
9Mentions
0Explicit recommenders
218GitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

Continuation-Passing Style for Nim 🔗

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 3:56:07 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year9 dated mentions

Observed mentions: 2021-10-19 11:07:56 UTC to 2026-07-29 11:41:35 UTC.

01232021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments20212022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 2 mentions; 1 submissions, 1 comments2023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments20232024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 2 mentions; 1 submissions, 1 comments2025-01-01 00:00:00 UTC to 2026-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2026-01-01 00:00:00 UTC to 2027-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments. Incomplete calendar period.2026*

* An incomplete calendar period is marked with an outlined bar. Its count is not directly comparable with a full period.

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC101
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC211
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC303
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC211
20252025-01-01 00:00:00 UTC2026-01-01 00:00:00 UTC000
2026 (partial)2026-01-01 00:00:00 UTC2027-01-01 00:00:00 UTC101

What Hacker News says

9 sources
If your language has macros, you don't need to wait for it to gain async/await (and it was quite a wait even in Python and JS, while Java got its virtual threads very recently); you can just[1] implement a CPS transform as a macro: https://github.com/nim-works/cps/blob/master/docs/cps.svg [1] Yeah, I know, this word is extremely overworked in that sentence. Sorry, that's an exaggeration for effect. In reality, it's not that simple, and not always possible: it depends on the language and macro system. It's still more likely to be implementable in library code if there is a macro system, though.
In Lisp moving Forth moving Lisp
`when myCondition():` instead of `if myCondition:` is done at compile-time. Alternatively you can use a `static:` code block to force compile time evaluation. Or tag a function {.compileTime.} or tag function inputs with `static` modifier. It is possible to create a compiler or an assembler running fully in Nim macros as well: - https://github.com/mratsim/constantine/blob/master/constanti... (all that file runs at compile-time) You can also implement Continuation-Passing-Style transformation at compile-time: - https://github.com/nim-works/cps Or a neural network DSL or for a self-contained example, einsum: - https://github.com/mratsim/Arraymancer/blob/master/src/array... It's worth noting that nim async/await transformation is fully implemented as a library in macros.
In D Programming Language
Ones that have not been mentioned so far: - npeg lets you write PEGs inline in almost normal notation: https://github.com/zevv/npeg - owlkettle is a declarative macro-oriented library for GTK: https://github.com/can-lehmann/owlkettle - ratel is a framework for embedded programming: https://github.com/PMunch/ratel - futhark provides for much more automatic C interop: https://github.com/PMunch/futhark - nimpy allows calling Python code from Nim and vice versa: https://github.com/yglukhov/nimpy - questionable provides a lot of syntax sugar surrounding Option/Result types: https://github.com/codex-storage/questionable - nlvm is an unofficial LLVM backend: https://github.com/arnetheduck/nlvm - chronos is an alternative async/await backend: https://github.com/status-im/nim-chronos - cps allows arbitrary procedure rewriting in continuation passi
Read the rest
In Nim 2.0
* Goroutines are probably a lot more easier to use. Work is being done to make Nim even better in that area: https://github.com/nim-works/cps but don't expect it soonish. * I feel like Go has less 'edge cases', but the Nim compiler is steadily getting more stable, especially consider it's not backed up by a major company! * Metaprogramming is really powerful, but not beginner friendly. The documentation says use macros when necessary, but personally I don't think that really happens in practice. The advantages by far outweigh the disadvantages, especially if you are looking for a clean Go alternative(except maaaaaaybeee web application). EDIT: my own wishlist, but they aren't relevant compared to Go: * Better sum types * Builtin pattern matching
In Nim 1.6

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.