[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
TYPOL Copy or Reference Semantics?
Hello TYPOL specialists,
i have a small question about the meaning of the following TYPOL rule:
|- op_lang1(A) -> op_lang2(a(op_lang1(A)));
op_langx are operators from two different languages.
Variable 'A' is of type 'lang1'.
Operator 'a' is of type 'lang2' and 'implemented as TREE' with METAL.
The purpose of the rule is to stop a conversion from 'lang1' to 'lang2'
with a reference node from 'lang2' to some node in 'lang1'.
This works well, my only questions is:
Is the reference a real sharing of the contents of 'A' or
does the TYPOL rule imply copy semantics?
The answer is not relevant for the semantics of the example but for the
question whether this 'referencing' allows data to be shared efficiently.
My experiences indicate copy semantics, but this might be due to clever
data holding of Centaur.
When i change the contents of an editor with text that is referenced or simply
close it the refering data is not affected.
However, i doubt this clearly implys copying.
Please let me know, whether my 'references' are memory consumers or
memory savers.
Best Regards,
Thomas