subfield

Override the dot operator to access nested subfields of a Nim object.

Pure Nim score 15/100 · tests present · no docs generated

Summary

Latest Version Unknown
License MIT
CI Status Failing
Downloads 0
Last Indexed 2026-07-21 05:24

Installation

nimble install subfield
choosenim install subfield
git clone https://github.com/jyapayne/subfield

OS Compatibility

Platform Linux macOS Windows FreeBSD OpenBSD NetBSD Android iOS WASM Embedded
subfield - - - - - - -

Source

Repository https://github.com/jyapayne/subfield
Homepage https://github.com/jyapayne/subfield
Registry Source nimble_official

README

subfield

A sub-field accessor macro for the Nim programming language. This lets you access nested fields within a Nim object or ref object.

Installation

nimble install subfield

Usage

import subfield

type
  C = object
    y: int
  B = object
    x: int
    c: C
  A = ref object
    b: B

var c = C(y: 0)
var b = B(x: 5, c: c)
var a = A(b: b)

echo a.x
echo a.y

# Prints:
#  5
#  0