Closed sttaft closed 1 year ago
It is clear :-) that pragmas are allowed in declare expressions even though the intent appears to have been to ban them. That's because 2.8(7/3) clearly allows pragmas anywhere a syntactic "item" appears, and the declarations in a declare expression are declare_items.
The real queston here is whether we want to allow such pragmas directly preceding the result expression, and if we want to reconsider allowing other pragmas.
In any case, this (and other issues) will be covered by the pragma problem AI I am already writing.
Randy.
This issue is included in AI22-0045-1, as the wording needed would change the wording needed for other fixes (especially the broken ban of pragmas in declare expressions :-).
My preference would be to only allow limited pragmas in declare expressions (perhaps just pragma Assert), as the potential implementation impact (possibly quite high) would be all out of proportion to the value (quite low). Declare expressions already have a bunch of unusual restrictions in order to keep them relatively cheap to implement, so this would not be very unusual for this feature.
I discussed this some in te AI discussion.
AI22-0045-1 has been approved by the ARG (again).
No pragmas are currently allowed inside declare expressions. Maybe pragma Assert could come in handy there, it is not uncommon to interleave assertions with declarations in normal declare blocks. It would help for SPARK too. |
From Ada Community Input: Claire Dross | dross@adacore.com | 2/9/2022 3:37:29