Nim is a compiled, garbage-collected systems programming language which has an excellent productivity/performance ratio. Nim's design focuses on efficiency, expressiveness, elegance (in the order of priority).
Dog
Dog # (V2)
type
Dog = object
age: int
# Another file (V2)
Dog = object of first_file.Dog
weight: int
type Thing = ThingV7 or so
all_types.Thing | all_types.Thing2
If you're happy to do this: something[test_a]() -> test_a.TypeA , then what about
something[test_a.TypeA]() -> test_a.TypeA ?
import macros
import "."/[test_a, test_b]
macro something(kind: untyped) =
quote do:
`kind`.Type(data: 5)
echo something(test_a)
echo something(test_b)
Error: expression 'test_a.Type(data: 5)' is of type 'Type' and has to be used (or discarded)
import macros
import "."/[test_a, test_b]
macro something(kind: untyped): untyped =
quote do:
`kind`.Type(data: 5)
echo something(test_a)
echo something(test_b)
(data: 5)
(data: 5)
Compiling C:\Users\jos\dev\tfp\labs\crag\tests\test_scanner (from package crag) using c backend
fatal.nim(53) sysFatal
Error: unhandled exception: index 3 not in 0 .. 2 [IndexDefect]
Tip: 3 messages have been suppressed, use --verbose to show them.
Error: Execution failed with exit code 1
... Command: C:\Users\jos\.nimble\bin\nim.exe c --noNimblePath -d:NimblePkgVersion=0.1.0 --path:C:\Users\jos\.nimble\pkgs\patty-0.3.4 --hints:off -r --path:. C:\Users\jos\dev\tfp\labs\crag\tests\test_scanner