comp.lang.ada
 help / color / mirror / Atom feed
From: Fionn mac Cuimhaill <invisible@hiding.from.spam>
Subject: Case dependence and coding standards
Date: Tue, 03 Jun 2003 05:05:36 GMT
Date: 2003-06-03T05:05:36+00:00	[thread overview]
Message-ID: <035odv8mfiksmqo69q0250qp141oebtdro@4ax.com> (raw)

With regards to the thread about case dependence - no, no, a thousand
times no! Keep Ada the way it is. I *would* like to see a fairly
simple way of getting the compiler to enforce coding standards. I
frequently annoy myself  by  writing something like Put_line when I
intended to to write Put_Line. It would be nice to be able to specify
some kind of coding standard dictionary as an appendage to a package
or procedure.

The source code of the dictionary could use an Ada-like syntax. For
example, consider a package named My_Package.

A coding standard dictionary might look something like this:


-- Coding standards for XYZ Software, Inc. 

dictionary My_Package is

    -- Identifiers not in the dictionary
    -- Look_Like_This
    default  mixed; 

    -- reserved words must be uppercase; if
    -- this is not specified, everything would be mixed
    reserved upper;
    
begin
  
  -- the first itemis not case
  -- sensitive; the second one
  -- is, and the compiler enforces it on
  -- the source code
  my_io_routine: My_IO_Routine;
  xyz_container: XYZ_Container;

end My_Package;

My_Package could of course be a parent to other packages, such as
My_Package.Child_Package; We could then have

dictionary My_Package.Child_Package is

    default upper;
    -- legal parameters for the default statement
    -- would be upper, lower, mixed, parent
    -- value parent means inherit
    -- value used by the parent package;
    -- it would not be allowed in dictionaries
    -- of packages that had no parents.

    -- compiler or editor/IDE enforces
    -- My_Package.MY_IDENTIFIER
    
begin
    ubig: uBIG;
    usmall: uSMALL;
end My_Package.Child_Package;

This would be way of specifying coding standards that would be
compiler-independent and editor/IDE independent and could be enforced
by either.

GNAT, which puts one package to a source file, could then have a .dic
file to go with the .ads and .adb file for a package. Gnatstub could
make a .dic file when it makes a .adb file. Gnatmake could force a
recheck of source code if the .dic file changes. And so forth ...

A future version of AdaGIDE could use the .dic file to drive automatic
formatting, as could future versions of EMACS, vim or JED. (if the
maintainers of those are sufficiently interested) Programmers 
could use their pet editors and still get the benefit of common
standards, automatically enforced.

Since this would have very little interaction with language standards,
the dictionary language could be standardized independently of Ada
itself.



             reply	other threads:[~2003-06-03  5:05 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-03  5:05 Fionn mac Cuimhaill [this message]
2003-06-03 17:31 ` Case dependence and coding standards Robert A Duff
2003-06-03 17:46   ` Vinzent Hoefler
2003-06-03 19:04     ` Robert A Duff
2003-06-03 23:37       ` Randy Brukardt
2003-06-04  2:39         ` Wesley Groleau
2003-06-04 13:28           ` Georg Bauhaus
2003-06-04 15:44             ` Preben Randhol
2003-06-04 22:32             ` Wesley Groleau
2003-06-05 12:01               ` Georg Bauhaus
2003-06-05 15:36                 ` Preben Randhol
2003-06-05 17:41                   ` Wesley Groleau
2003-06-05 17:47                     ` Preben Randhol
2003-06-05 17:51                       ` Preben Randhol
2003-06-05 18:32                 ` Wesley Groleau
2003-06-06  8:58                   ` Georg Bauhaus
2003-06-07  0:53                     ` Wesley Groleau
2003-06-10 15:05                       ` Georg Bauhaus
2003-06-05 17:32               ` Wesley Groleau
2003-06-05 17:43                 ` Preben Randhol
2003-06-04  8:39       ` Vinzent Hoefler
2003-06-04 16:32         ` Stephen Leake
2003-06-05  1:27           ` Robert I. Eachus
2003-06-05  7:47           ` Vinzent Hoefler
2003-06-05 17:47             ` Stephen Leake
2003-06-05 19:43               ` Wesley Groleau
2003-06-06  9:27               ` Georg Bauhaus
2003-06-06 10:29                 ` Preben Randhol
2003-06-03 19:38   ` Stephen Leake
  -- strict thread matches above, loose matches on Subject: below --
2003-06-04 17:00 Lionel.DRAGHI
replies disabled

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