[capidl] Re: exprs in parse tree
Jonathan S. Shapiro
Tue, 18 Sep 2001 14:05:36 -0400
>> It proves that there may be a reason to preserve them: documentation.
>> const OC_SomeCodePoint = 43;
>> interface mumble(args mumble) = OC_SomeCodePoint;
> Oops. You are completely correct.
Unfortunately, there is collateral damage the moment we accept expressions
as input where output documentation is a concern. Consider the small
interface mumble (args mumble) = OC_SomeCodePoint + 2;
This can either be output as the result of the expression, or the expression
tree can be output. In the former case, documentation is lost. In the latter
case, integer computation may be lost depending on the output language.
My belief is that the only compelling case for documentation may be in the
interface code point assignment and possibly in the typecase dispatch values
for discriminated unions. One "solution" would be to require these to be
numeric constants or constant symbols rather than allowing general
expressions in these locations. The determined programmer can alway write
const integer mystupidity = OC_SomeCodePoint + 2;
interface mumble (args mumble) = mystupidity;
I'll leave the grammar as-is for now and leave the expressions in the parse
tree. We can very easily introduce an expression processing 2nd pass later.