omni
omni copied to clipboard
Remove need of calling constructor on complex structs
struct A:
a
struct B:
a A
init:
b = B() #this should be enough, instead of B(A())
This perhaps requires removing the objects as ptr
to something, and instead letting them be just normal nim's object
types. They could be inheriting from a common OmniStruct
object that would help when parsing def
arguments, in order to still allow this:
struct A:
a
def set_value(a A, val):
a.a = val
init:
a A = A()
a.set_value(0.5)
What about Data
though?
Should Data
look at all the entries of each struct recursively and call the standard constructor, initializing all Datas
along the way? What size should those Datas
have though? Perhaps I can come up with a way of using this syntax ONLY for top-level Datas
, meaning: Datas
that do not contain struct
with other Datas