Skip to content

Correction: update the stored-empty container aggregate example - #1396

Merged
gusthoff merged 3 commits into
AdaCore:mainfrom
gusthoff:dev/topic/content/courses/advanced-ada/empty-container-aggregate/2026-10-25
Oct 30, 2026
Merged

gusthoff merged 3 commits into
AdaCore:mainfrom
gusthoff:dev/topic/content/courses/advanced-ada/empty-container-aggregate/2026-10-25

Conversation

@gusthoff

Copy link
Copy Markdown
Collaborator
  • Return the stored empty value through an expression function.
  • Add a runnable demonstration and remove the older GNAT pin.

Co-Authored-By: Codex noreply@openai.com

gusthoff and others added 2 commits October 25, 2026 02:51
Return the stored empty constant through an expression function.

Co-Authored-By: Codex <noreply@openai.com>
- Demonstrate that an empty aggregate returns the stored empty value.
- Enable the run button and remove the older GNAT pin.

Co-Authored-By: Codex <noreply@openai.com>
@gusthoff
gusthoff requested a review from swbaird October 25, 2026 00:54
swbaird
swbaird previously approved these changes Oct 26, 2026

@swbaird swbaird left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. There is always more one could add - in this case, we could also talk about the case where the Empty function takes a parameter (in addition to talking about the parameterless case). But this change is fine as it stands.

- Wrap the `Put_Line` expression to respect the Advanced Ada course
  50-column limit.
- Validate all seven chapter examples with `--max-columns 50`.

Co-Authored-By: Codex <noreply@openai.com>
@gusthoff

Copy link
Copy Markdown
Collaborator Author

Looks good. There is always more one could add - in this case, we could also talk about the case where the Empty function takes a parameter (in addition to talking about the parameterless case). But this change is fine as it stands.

Thanks for the suggestion! I'll put this on my list and work on it separately.

@gusthoff
gusthoff merged commit 8428075 into AdaCore:main Oct 30, 2026
16 checks passed
@sttaft

sttaft commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

@gusthoff @swbaird I noticed on line 78 of the ".rst" file that you say that you cannot specify both Add_Named and Add_Unnamed in the Aggregate aspect. However, AI22-0134-1 (Aggregate-named-and-unnamed) changed that, and now allows both to be specified, with Add_Unnamed being used any place where it is legal, and Add_Named used when you give an explicit "use Key => XXX".

I imagine we don't describe this new feature since it is an approved amendment, but one that is not part of Ada 2022 (and not part of the first Ada 2022 amendment being standardized as we speak). How are we handling such approved amendments? Do we mention them for future reference, ignore them completely, or pretend they are already part of the language?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants