From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,15890893c0618a8a X-Google-Attributes: gid103376,public From: Laurent.Guerby@enst-bretagne.fr (Laurent Guerby) Subject: Re: [Q] Tools for Ada Quality and Style [LONG] Date: 1996/05/01 Message-ID: <4xwx2w8dn5.fsf_-_@leibniz.enst-bretagne.fr> X-Deja-AN: 152441038 distribution: world sender: guerby@leibniz.enst-bretagne.fr references: <9604172134.AA27114@eight-ball> <4m3ouj$b0p@inferno.mpx.com.au> content-type: text/plain; charset=US-ASCII organization: Telecom Bretagne mime-version: 1.0 newsgroups: comp.lang.ada Date: 1996-05-01T00:00:00+00:00 List-Id: Robert A Duff writes : Yeah, it's pretty nice, and I use it all the time. But let me play : Devil's Advocate for a moment. Let's play ;-). I've changed the order of the original items. : >- Customization (sometimes seen as a nightmare for emacs user but not : >so difficult if you read the manuals ;-). : : Easy customization is a two edged sword. It means the designer of the : program doesn't need to make it do something reasonable by default, : because, hey, anybody who doesn't like it can change it. The "reasonable default" remark is a good point. If you look at the evoluation of emacs (19.N), there's less and less to do to customize, and there's more and more stuff in menus. I disagree for the "the program doesn't need ..." in a general sense, of course elisp programmers are free to write their free code as they want ;-). : I've done a : small amount of Emacs-Lisp programming, and I agree, it's not all that : difficult, but still, why should an Ada programmer have to learn how to : program Emacs? (Counter argument: learning Lisp, or any dialect : thereof, is good for the soul. ;-) ) On the learing side, "an Introduction to Emacs LISP" is freely available under your favourite info mode ;-) and tailored for that. : >- Find definition of everything (procedure, types) since the Ada mode : >parses gnatf outpout). : : And the gnatf output is usually out of date, because there's no easy and : fast way to keep it up to date with my latest keystrokes. : : >- Cross reference tool, gnatf (ASIS soon, may be integrated under : >emacs). : : Again, how do you keep the output up to date? The default behaviour of the Ada mode is to rerun gnatf, but this doesn't work because your file still does not contain most of the time a correct Ada unit. I believe that a few things are planned in this area. The ASIS for GNAT will be of some help for the Ada mode (still future). If you're looking for the definition which is in the file you're editing, the C-s and C-r keystrokes give you a quick way to get some information. I also use multiple windows (or frames if my emacs is not eating all my display ;-) on the buffer, one for useful declarations (current buffer or other things), one for typing. : >- Integrated multi language debugger gud/gdb (with a bit of experience : >it works for tasking and distributed programming). : : Gdb's understanding of Ada is still pretty immature, IMHO. The : integration with Emacs is nice, though. Most of my bugs (if not caught : at compile time) are some sort of assertion or constraint check failure : that localized the problem pretty well (when I'm lucky!), and then the : incorrect code is sitting right there ready to be edited. But when I go : beyond those simple (usual) cases, gdb gets confused. I don't know which version of gdb GNAT aware you use. gdb 4.16 has now been released and may be a new release of the GNAT patch will be released soon. Of course gdb for Ada is still immature compared to state of the art Ada 83 debuggers. There's some weak points in the current release, for variable declared in local blocks, and a bit for tagged types until you're inside a known primitive operation. For tasking and distributed systems issues, it works better when you're a bit aware of the run-time (it's useful to step into the run-time sources sometimes ;-) (also true for tagged types). But there's also a big advantage for gdb, multiple language debugging is working very well. On this point, there's also the SGI Programmer Workshop, which use GNAT, and an in-house debugger (not gdb I think, better check it), also multiple-language (with some interesting feature sharing between languages). : >- Multi sources syntactic and semantic checks with window and point on : >error ala Turbo Pascal (with the GNAT messages in bonus). : : The Devil has nothing to say here. Yes, this is quite nice. : : >- RCS or CVS support (with systematic window for log entry). Ok ok ;-). : >- Pretty printer integrated (emacs font(lazy)-lock plus ps-print). : : Which sometimes garbles the code. Often enough that I can't really : trust it to format large regions of code, without checking what it did, : by hand. It doesn't really understand the entire syntax of Ada : correctly. (I'm talking about bugs here, not just disagreements on : formatting style.) : : >- Reformater on demand (non too much intrusive). : : Not sure how this is different from the first item. There's three different topics here, standard code REformater, Ada aware editors, and how to get a nice PostScript from your source. Emacs can be used for the three items. There's some known problem for the Ada mode, but not that much with the last release (2.20). Here is my personal view on the topic : - I don't like REformater, I prefer on the fly helper for formatting. An automatic tool cannot transform poor code in good one, doesn't add comments, correct design, etc ... If you've to import some code, the best (IMHO) is to let is as is, not to cheat about it (different coding standard, etc ...). Of course you've to convince your managers if they're using for an automatic tool for quality, with a boolean answer ;-). And re-design something can be a big step towards quality (with some knowndrawbacks, see the Myhtical Man Month for example), but you've to plan it to see if it's cost effective. [May be it would be better to start an appropriate thread for this issue ;-] - I like the way the Ada mode works as an Ada aware editor. If you type "beghin" instead of "begin", the word stay in black, instead of blue (or violet ;-) as usual for a keyword, no need to run the compiler. If you've omitted a ";", TAB doesn't work well on the next line (idem for imbricated constructs), so you're aware of it really soon. And the customization of indentation is well documented in the standard dot-emacs file. - Pretty printer: if you've followed my first advice, ps-print just allow you to print exactly your buffer, so there's no problem here (use the pstools if you want multiple columns on one sheet of paper). Note that every item here is a matter of taste (except annoying bugs in your tool ;-). There's no unique solution to these issues, only two useful advices (from AQ&S) : "think about it ASAP" and "be consistent". : >- ACT coding standard (syntactic) switch plus some tools to do some : >minor reformatings. : : Last time I checked, the ACT coding standard wasn't documented very well : -- you have to guess what it is by looking at existing code, and dealing : with error messages from the style checker. I think (old post from Robert Dewar) that the plan is to separate a general purpose flag (casing consistency and things like that) and the *internal* ACT style flag. As the ACT standard is likely change, you can use it for useful advices, but madate it is tricky. For documentation, here is the source (opt.ads from my beta version) : Style_Check : Boolean := False; -- GNAT, GNATF -- Set True to perform style checks. Activates checks carried out -- in package Style (see body of this package for details of checks) : > Of course it's worth every penny ;-). ... : : Agreed. I use it every day! ;-) There's a mailing list for Ada mode issues (user feedback, configuration, releases, request for improvements), you can get more information from my home page about these issues with some useful advices (file conf.html, see my signature for URL). : - Bob -- -- Laurent Guerby, student at Telecom Bretagne (France), Team Ada. -- "Use the Source, Luke. The Source will be with you, always (GPL)." -- http://www-eleves.enst-bretagne.fr/~guerby/ (GATO Project). -- Try GNAT, the GNU Ada 95 compiler (ftp://cs.nyu.edu/pub/gnat).