I do not understand accessibility levels, while watching tutorial videos from AdaCore, in particular this one: https://youtu.be/nfBwXxAf7UE?t=1418
The example is as follows:
type An_Access is access all Integer;
procedure Proc is
W : aliased Integer;
X : An_Access := W'Access;
begin
null;
end Proc;
The tutorial says "X is of accessibility level 0, W is of accessibility level 1. Allowing this declaration would permit reference to the object outside of the scope."
Why would the point at which the access type is declared affect the access variables in different scopes? I mean, both W and X are local to Proc and will go out of scope and will not be usable once Proc is finished. So why would it matter, where the type of X is declared?