Talk:Ada Programming/Aspects

Default value for Boolean aspects

> Values of aspects not specified are left to the compiler; Boolean valued aspects have the default value False.

Hi @CKWG - Ada Magica:

Isn't it the opposite? with Pack implies with Pack => True or with No_Return is the same as with No_Return => True.

Update: I see now that you refer to the case when the aspect is not specified at all, and I was referring to the case when the aspect *value* is not specified. Maybe we should add both circumstances.

-- ManuelGR (discusscontribs) 12:22, 9 January 2022 (UTC)

Hi Manuel,

you're right, the wording is not optimal. I'll try to improve the text.

Christoph

@ManuelGR:

Hm, I guess saying the "default for unspecified boolean aspects is False" is wrong. Take as example the aspects Pack and Inline. For Pack, the following pairs of two lines are the same.

type Bool_Arr is array (Index) of Boolean with Pack;
type Bool_Arr is array (Index) of Boolean with Pack => True;
type Bool_Arr is array (Index) of Boolean;
type Bool_Arr is array (Index) of Boolean with Pack => False;

However for Inline, it's different. The compiler is free to inline any subprogram when optimizing code. On the other hand, specifying Inline may be ignored. For GNAT, a compiler option is needed for inlining.

CKWG - Ada Magica (discusscontribs) 09:46, 10 January 2022 (UTC)

That's because Inline is a recommendation to the compiler, but in fact, when the aspect is not specified, its value (the recommendation) is False. I don't know if this default applies to all the aspects, but for Inline I've found this:
5.2/3
If directly specified, the aspect_definition shall be a static expression. [This aspect is never inherited;] if not directly specified, the aspect is False.
-- ManuelGR (discusscontribs) 19:59, 10 January 2022 (UTC)