You can use macros to provide class-like capabilities to object variants (i.e. 
constructing the object variant from multiple modules)

See: 
[https://github.com/mratsim/trace-of-radiance/blob/99f7d85d/trace_of_radiance/support/emulate_classes_with_ADTs.nim](https://github.com/mratsim/trace-of-radiance/blob/99f7d85d/trace_of_radiance/support/emulate_classes_with_ADTs.nim)

The only limitation is that in other languages like C++, you can add a new 
subtype even when the library is compiled as a DLL while with macros you need 
compilation from source. But current Nim methods have the same limitation.

Reply via email to