!topic LSN on Trailing Underscores !key LSN-1067 on Trailing Underscores !reference RM9X-2.3;4.0 !from Bob Duff $Date: 94/01/29 17:05:10 $ $Revision: 1.3 $ !discussion The current version of Ada 9X allows identifiers to contain trailing underscores, as in This_Is_An_Identifier_. Ada 83 did not allow that. There has been much debate recently over whether this language change is a good idea. This LSN recommends reverting to the Ada 83 rule. At the recent DR/XRG meeting in the UK, a vote was taken on the issue. The vote was inconclusive: Vote: To maintain position in draft 4.0 All(5-8-3) XRG(2-3-1) Vote: To revert to the Ada 83 position. All(7-7-2) XRG(3-3-0) In reading the messages from various people on the subject, it seems that most people who are against trailing underscores feel very strongly about it, whereas most people who are in favor of trailing underscores feel less strongly. (I happen to be in the latter camp, but I still recommend reverting to the Ada 83 rule!) One of the arguments in favor of trailing underscores is that we shouldn't have silly rules of this nature in the RM -- let people do what they want. However, leading underscores and double underscores are still illegal in version 4.0. So we have failed to achieve this end in any case. Another argument in favor of trailing underscores is that C allows trailing underscores, and we would like to ease the interface to C. (C is also case sensitive, but it is typical style to use all lower case for function and variable names, so that issue doesn't hurt too much in practise.) However, it is much more common to use leading underscores in C than trailing ones, so the version 4.0 rule is of little help in interfacing to C. C also allows doubled underscores (and these are sometimes used). Hence, one must sometimes specify a link_name to interface to C. Another argument in favor of trailing underscores is for upward compatibility: if an Ada 9X reserved word appears in an Ada 83 program as an identifier, append an underscore. This can be automated. However, in the near term, this is a poor solution -- one will usually want one's programs to be legal in both Ada 83 and Ada 9X. A better solution would be to append an arbitrary string to the end of each offending reserved word. Sequence numbers could be added in the unlikely event of a conflict with an existing identifier. The user could search for the arbitrary string, and modify them as desired. Another argument in favor of trailing underscores is for writing programs where the most sensible name for something is a reserved word. For example, some people would like to write: Digits_: Integer := 10; in a program for counting fingers. This sort of thing comes up a lot in Ada compilers. However, there seem to be at least as many people who think this sort of thing is evil. Therefore, and in view of the fact that we have failed to achieve a consensus on the version 4.0 rule, the MRT recommends reverting to the Ada 83 rule.