comp.lang.ada
 help / color / mirror / Atom feed
From: Peter Chapin <PChapin@vtc.vsc.edu>
Subject: Re: Indentation
Date: Fri, 08 Aug 2014 13:45:44 -0400
Date: 2014-08-08T13:45:44-04:00	[thread overview]
Message-ID: <6dCdndsS1IpUkXjO4p2dnAA@giganews.com> (raw)
In-Reply-To: <ls30lf$cj2$2@dont-email.me>

On 2014-08-08 13:16, Jeffrey Carter wrote:

> What is new in Ada 12 that I haven't worked with yet is the aspect
> clause. This is clearly part of the type declaration, not nested within
> it, and so should be part of the type framing text. So I would probably
> indent this as
> 
> type T (Flag : Boolean := False) is record
>    case Flag is
>    when False =>
>       F1 : Float := 0.0;
>    when True =>
>       F2 : Integer := 0;
>    end case;
> end record with Unchecked_Union;

To my mind the aspects should be introduced on a separate line so they
aren't lost. I had to review the declaration above a couple of times
before I realized the aspect was even there.

I favor indenting the aspect. Consider the common case where there are
multiple declarations at the same level

   type X_Type is ...;
   type Y_Type is ...;
   procedure A(...);
   function B(...) return ...;

If you slip an aspect in at the same level of indentation as the
declaration to which it is attached it clutters things considerably.

   type X_Type is ...
   with ...;
   type Y_Type is ...
   with ...;
   procedure A(...)
   with ...;
   function B(...) return ...
   with ...;

Of course adding some blank likes would help but I still like to see the
aspect set off so its association with the previous declaration is obvious

   type X_Type is...
     with ...;
   type Y_Type is ...
     with ...;
   procedure A(...)
     with ...;
   function B(...) return ...
     with ...;

Peter

  reply	other threads:[~2014-08-08 17:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-08 16:12 Indentation Victor Porton
2014-08-08 16:32 ` Indentation Adam Beneschan
2014-08-08 17:16   ` Indentation Jeffrey Carter
2014-08-08 17:45     ` Peter Chapin [this message]
2014-08-08 17:50       ` Indentation Peter Chapin
2014-08-08 22:51     ` Indentation Randy Brukardt
2014-08-08 16:38 ` Indentation Pascal Obry
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox