voodoo
Working with Nim's macros is just Voodoo
Summary
| Latest Version | 0.2.0 |
|---|---|
| License | MIT |
| CI Status | Failing |
| Downloads | 0 |
| Last Indexed | 2026-07-21 05:27 |
Tags
Authors
- George Lemon
Installation
nimble install voodoo
choosenim install voodoo
git clone https://github.com/openpeeps/voodoo
OS Compatibility
| Platform | Linux | macOS | Windows | FreeBSD | OpenBSD | NetBSD | Android | iOS | WASM | Embedded |
|---|---|---|---|---|---|---|---|---|---|---|
| voodoo | ✓ | ✓ | ✓ | - | - | - | - | - | - | - |
Dependencies
| Package | Version | Optional |
|---|---|---|
| nim >= | 2.0.0 | No |
Source
| Repository | https://github.com/openpeeps/voodoo |
|---|---|
| Homepage | https://github.com/openpeeps/voodoo |
| Registry Source | nimble_official |
README

Working with Nim's macros is just Voodoo!
A collection of utilities to build awesome tools!
nimble install voodoo
About
Voodoo is a Nim package that provides a collection of tools and utilities to build awesome packages and applications using Nim's powerful macro system.
😍 Key Features
- Generate fast
getters/settersfrom object fields - Make
extensibleenums/objects
Examples
Here are some examples of what you can do with Voodoo.
Getters
Generate fast getters from object fields without explicitly writing them. Currently, in Nim you cannot read private fields from other modules. Voodoo's getters pragma makes it easy to generate public getters for private fields.
Excluding specfic fields is also supported.
import pkg/voodoo
type
Price* {.getters.} = object
net, gross: string
Product* {.getters: [id].} = object # exclude one or more fields
id: string
title, short_description: string
price: Price
expandGetters() # is required to expand generated procs.
expandGetters will generate the following getters:
proc getNet*(price: Price): string =
## Get `net` from `Price`
result = price.net
proc getGross*(price: Price): string =
## Get `gross` from `Price`
result = price.gross
proc getTitle*(product: Product): string =
## Get `title` from `Product`
result = product.title
proc getShortDescription*(product: Product): string =
## Get `short_description` from `Product`
result = product.short_description
proc getPrices*(product: Product): Price =
## Get `price` from `Product`
result = product.price
Setters
todo
Extensibles
It's easy to make extensible enums/objects. This is super useful when building frameworks or libraries where users may want to extend your types.
Also, extensible pragma works with both public or private definitions
import voodoo/extensible
type
Cardinal* {.extensible} = enum
north, west
Done! Now Cardinal is an extensible enum. Any other modules/packages importing it can easily add fields to this enum. Yep, that's voodoo!
import voodoo/extensible
# `extendEnum` macro is used to add new fields to an extensible enum.
# it is required to do this before importing the extensible enum's module.
extendEnum Cardinal:
south
east
# the extensible enum's module is imported after we setup the extensions.
import ./cardinalModule
assert compiles(Cardinal.north)
assert compiles(Cardinal.south)
assert compiles(Cardinal.east)
❤ Contributions & Support
- 🐛 Found a bug? Create a new Issue
- 👋 Wanna help? Fork it!
- 😎 Get €20 in cloud credits from Hetzner
🎩 License
MIT license. Made by Humans from OpenPeeps.
Copyright © OpenPeeps & Contributors — All rights reserved.