[GAP] Question about subprogram syntax

Robert Dewar dewar at adacore.com
Wed Feb 22 13:00:53 CET 2006


Erhard Ploedereder wrote:
> Yes, it definitely is a matter of taste.
> 
> However, when you see code like
>    ThisVar := Length + Origin - Offset;
> and you are asked:
>    Does this code have any effect other than changing ThisVar (and
>    its aliases) ?
> 
> The empty parentheses community can immediately and with assurance
> answer "No".
> 
> The no-parentheses community will have to hem and haw and consult symbol
> tables to determine whether there can be any side effects due to any
> of the identifiers standing for a function call.

Not in real life. I have never seen any such hemming and hawing? Why,
because decent names mean that this kind of confusion does not in
fact arise. If I saw the code above in any reasonable Ada program,
certainly including anything you would find in the GNAT code, then
the answer is immediate.

Note that it would be trivial in an editor to color function calls
a different function if you thought this was actually useful.

That's a "fix" with no language consequences (nice exercise for the
reader, make this change to GPS :-))



More information about the GAP mailing list