Simon Wright <[email protected]> writes:

> At the moment, ‘not null’ in a parameter list is treated as though it was 
> always part of ‘not null access’, so that C-c C-a gives the result below; 
> procedures C & D aren’t right.
>
> package Not_Null_Access is
>
>   type Integer_P is access Integer;
>
>   procedure A (P1 : access Integer;
>                P2 : in out Integer);
>
>   procedure B (P1 : access          Integer;
>                P2 : not null access Integer);
>
>   procedure C (P1 :                 Integer;
>                P2 : not null        Integer_P);
>
>   procedure D (P1 : access          Integer;
>                P2 : not null        Integer_P);

Ah. I did not realize 'not null' could occur without 'access'.

But we can also have 'in out not null'. That currently gives:

   procedure I
     (A : in not null     Z_Access;
      B : not null        Z_Access;
      C : in out          Z_Access)
   is begin
      null;
   end I;

When 'access' is present, 'not null access' is the mode, and aligns with
'in out'. But when 'access' is not present, 'not null' is part of the
type. So perhaps it should be:

   procedure I
     (A : in     not null Z_Access;
      B :        not null Z_Access;
      C : in out Z_Access)
   is begin
      null;
   end I;

To make things worse, we can also have a 'not null access' parameter,
which would give:

   procedure I
     (A : in              not null Z_Access;
      B :                 not null Z_Access;
      C : in out          Z_Access;
      D : not null access Z)
   is begin
      null;
   end I;

which looks silly. But I hate special cases :).


I've recently added support for 'aliased' in parameter lists, which is
new in Ada 2012; it has to be before 'in out'.

> # HG changeset patch

I gather you are using Mercurial. How does it compare to git and
monotone, in your experience?

What front-end are you using?

-- 
-- Stephe

_______________________________________________
Emacs-ada-mode mailing list
[email protected]
http://host114.hostmonster.com/mailman/listinfo/emacs-ada-mode_stephe-leake.org

Reply via email to