objaccess
generate setters and getters for object types
Summary
| Latest Version | Unknown |
|---|---|
| License | MIT |
| CI Status | Failing |
| Downloads | 0 |
| Last Indexed | 2026-07-21 05:23 |
Tags
Installation
nimble install objaccess
choosenim install objaccess
git clone https://github.com/choltreppe/objaccess
OS Compatibility
| Platform | Linux | macOS | Windows | FreeBSD | OpenBSD | NetBSD | Android | iOS | WASM | Embedded |
|---|---|---|---|---|---|---|---|---|---|---|
| objaccess | ✓ | ✓ | ✓ | - | - | - | - | - | - | - |
Source
| Repository | https://github.com/choltreppe/objaccess |
|---|---|
| Homepage | https://github.com/choltreppe/objaccess |
| Registry Source | nimble_official |
README
This package lets you generate getter and setter procs for object types. For situations where you only want the outside world to be able to do one of those, so exporting the field doesnt do the trick.
There are two options:
setable, getable macros
type Obj* = object
a, b: int
c: bool
d: string
Obj.getable(a, b)
Obj.setable(d)
customAccess pragma
Note: this doens't work with mutual recursive types.
type Obj* {.customAccess.} = object
a {.getable.}, b {.getable.}: int
c: bool
d {.setable.}: string