You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Looking at the messages from running builds on code snippets in the course "Introduction to Ada", it seems to me that code snippets should be reworked to avoid distracting warnings that do not correspond to the issue being illustrated by the code snippet.
As an example, take the chapter on Arrays. In the section on "Predefined array type: String", hitting Run on the first "greet" code snippet issues this warning:
greet.adb:4:04: warning: "Message" is not modified, could be declared constant [-gnatwk]
This is highlighted in red, pointing to something the user might consider important here. It is not. The constant should in fact be declared with "constant" keyword to avoid that warning.
Take the "main" example that follows. Hitting Run generates three warnings, again highlighted in red:
main.adb:1:09: warning: no entities of "Ada.Text_IO" are referenced [-gnatwu]
main.adb:1:19: warning: use clause for package "Text_IO" has no effect [-gnatwu]
main.adb:7:04: warning: constant "My_Array" is not referenced [-gnatwu]
This could be avoided for the first two lines by removing the useless reference to Ada.Text_IO (which looks like a good idea anyway as this is not used for the explanation of this code snippet), but that would not work for the last line. Here, given the incomplete nature of code snippets, where you may end up declaring entities that are not used (code ellipsis), I recommend to compile the code of this snippet and all others with the switch -gnatwU.
This is a general comment that applies to all the content on learn, but in particular to the content of the course "Introduction to Ada", since newcomers are more likely to get confused by such messages.
The text was updated successfully, but these errors were encountered:
Looking at the messages from running builds on code snippets in the course "Introduction to Ada", it seems to me that code snippets should be reworked to avoid distracting warnings that do not correspond to the issue being illustrated by the code snippet.
As an example, take the chapter on Arrays. In the section on "Predefined array type: String", hitting Run on the first "greet" code snippet issues this warning:
This is highlighted in red, pointing to something the user might consider important here. It is not. The constant should in fact be declared with "constant" keyword to avoid that warning.
Take the "main" example that follows. Hitting Run generates three warnings, again highlighted in red:
This could be avoided for the first two lines by removing the useless reference to
Ada.Text_IO
(which looks like a good idea anyway as this is not used for the explanation of this code snippet), but that would not work for the last line. Here, given the incomplete nature of code snippets, where you may end up declaring entities that are not used (code ellipsis), I recommend to compile the code of this snippet and all others with the switch-gnatwU
.This is a general comment that applies to all the content on learn, but in particular to the content of the course "Introduction to Ada", since newcomers are more likely to get confused by such messages.
The text was updated successfully, but these errors were encountered: