!standard 3.3(11.1/3) 18-04-09 AI12-0270-1/00 !standard 3.3(12) !class Amendment 18-04-09 !status Hold by Letter Ballot (10-0-1) - 18-05-07 !status work item 18-04-09 !status received 18-04-09 !priority Low !difficulty Medium !subject Eliminate differences between use of values and objects !summary Eliminate all places where an object is required and an expression is not. !problem After various changes in Ada 95 and Ada 2012, there is no rhyme nor reason to the difference between expressions that represent objects and those that represent values. Consider the following: Limit : constant := 10; Max : constant Natural := 10; Ren1 : Natural renames Natural'(1); -- Illegal, not object. Ren2 : Natural renames Natural'(+1); -- Legal, "+1" is equivalent to a -- function call "+"(1), and the result -- result object of a function call -- is clearly an object [3.3(13)]. Ren3 : Natural renames Natural(+1); -- Illegal, not object (value -- conversion isn't an object). Ren4 : Natural renames Natural'First;-- Illegal, not object. Ren5 : Natural renames Natural'Val(1); -- Legal, object. (Val denotes a -- function.) Ren6 : Natural renames Natural'(Max);-- Legal, object. Ren7 : Natural renames Natural'(Limit); -- Illegal, not object. (A named -- number is not an object.) Ren8 : Natural renames Max; -- Legal, object. Ren9 : Natural renames (Max); -- Illegal, not object. (A parenthesized -- expression is not an object, -- regardless of what is -- parenthesized.) RenA : Boolean renames Boolean'(A and B); -- Legal, object. ("and" is -- a function.) RenB : Boolean renames Boolean'(A and then B); -- Illegal, not object -- ("and then" is an operation, not a function.) How many of you got this right? We should at least fix the worst warts of this list. !proposal (See Summary.) !wording ** TBD. !discussion The kinds of expressions that are not objects are: * value conversions (of non-objects if AI12-0226-1 is approved); * parenthesized expressions; * numeric literals; * the literal null; * named numbers; * membership tests; * short circuit control forms; * attributes that are not defined as functions. These all represent constants; it would probably be better to define which objects are variables (a much shorter list) rather than which ones are constants. Additionally, many of the above things are not syntactally allowed in contexts where objects are required (specifically, the LHS of an assignment and the name renamed as an object must be "name"s, not "expression"s). We would need to remove the syntactic distinction in order for any changes to be useful, particularly in the cases of objects that can be constants (in some aspect specifications, renames-as-objects, and attribute prefixes). !ASIS [Not sure. It seems like some new capabilities might be needed for operators, but I didn't check - Editor.] !ACATS test An ACATS C-Test is needed to check that the new capabilities are supported. !appendix ****************************************************************