Hi,

So in Lua, as far as I can say, there is no way to express directly something like `a = {b=1, c=a.b}`. Instead one might use functions, and call the table with the instance method call operator (colon), like
`a = {b=1, c=function(s) return s.b end}; a.b == a:c() -- true`.

A first minor problem is that it introduces asymmetry in form. A solution which would allow to call equally
`a.b` and `a.c` would be more interesting for this use case.

Moreover, `a.c = 2` should lead to a state where `a.b == a.c and a.b == 2`

More context: the goal is to store lexicological informations in data modules. Entries might share one or more descriptive material. The important point which lead to this consideration is that the data module should be modifiable from outside the module, without requiring huge integrity
constraint at each description change.

But maybe I'm not taking the simplest approach here, so feel free to suggest totally different solution.

Kind regards

_______________________________________________
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to