Actually, there is one sidenote:
Say I have predefined getE1(g), getE2(g) .... I need to programatically change s.efunc when I change one of the props. Naively I would do something like this:
function setPropB(s)
s.prop_b = true
s.efunc(s) = getE2(s)
end
this immediately gives the error
ERROR: syntax: Global method definition around ... needs to be placed at the top level, or use "eval".
Instead trying
function setPropB(s)
s.prop_b = true
eval(:(s.efunc(s) = begin; getE2(s); end ))
end
works, but is MetaProgramming, if I’m not mistaken, which is often discouraged here. Are there any caveats to using eval in this way?