There's a lot to take in in this, and I'm understanding some of it, but I'll
take some more time to see if I can grasp it mostly. There's quite a few things
that are new or still mysterious to me.
I noticed I can sort of shortcut it with
template action():untyped = Action( properties: %*{} )
var a = action
a.algo = 10
echo a.algo # 10
Run
in case an empty Action is needed, or to not have to type the whole
**properties: %*{}** thing (might be redundant, I was just trying out things
and stumbled on that. Still trying to grasp templates).
Meanwhile, I am wondering -- and this is just a curiosity; I don't intend to
explore this path myself -- if with some clever use of templates like this, and
assuming one can overload the {} operators to this end, if one couldn't come up
with a Nim implementation of the exact behavior of python dictionaries?
# basically so that one could do just this:
let a = {
some_str:"bla bla",
some_int:10
}
# or like this
var a = {}
a.derp = 10
a.depier = "the derpest"
Run