comp.lang.ada
 help / color / mirror / Atom feed
* RE: Standard Ada Preprocessor (Was: why ada is so unpopular ?)
@ 2004-01-26 20:03 Lionel.DRAGHI
  2004-01-26 23:10 ` Robert A Duff
  0 siblings, 1 reply; 85+ messages in thread
From: Lionel.DRAGHI @ 2004-01-26 20:03 UTC (permalink / raw)
  To: comp.lang.ada



| -----Message d'origine-----
| De: Warren W. Gay VE3WWG [mailto:warren@ve3wwg.tk]
...
| >>
| >>> C with preprocessor directives is also Maintenance Hell. 
| I don't see 
| >>> that it's a better Hell.
| >>
| >> Given that it should be optional, it would not be your problem ;-)
| 
| I would tend to agree. There is no "pure" way to make non-trivial
| code portable.
| 
| If we go back to the "non-normalized database" metaphore, keeping
| separate versions of code for purity sake (to avoid conditional
| compilation), is like having to update a customer name in a
| database in 12 different tables. This potentially leads to
| leaving one instance of that name wrong, or left unchanged.

A good design allows to separate common and customized code in a pretty
sharp way.
There is no free lunch, and you need some more code and design.
Method template and Strategy patterns are useful here.
It is possible (and not so hard) to get a software with no embedded dead
code, and with almost no possible source confusion, that is, with the whole
configuration defined in one source.

Lets consider two OS interfaces (not compiled code) :

----------------------------------------------------------
package OS_Interface is
  procedure Open_File (Name ...
                       ...);
  ...
  -- etc.

private
  type Abstract_Interface is abstract ...
  procedure Open_File (Abstract_Interface ...
                       Name ...
                       ...) is abstract;
  ...

  procedure Register_As_Concrete (Abstract_Interface'class'Access...); 
  -- used by child interfaces to register themself 

end OS_Interface;

----------------------------------------------------------
package body OS_Interface is

   Concrete : ... -- pointer to the concrete Interface, 
   -- set by Register_As_Concrete 

 
   procedure Open_File (Name ...
                        ...) is
   begin
      Open_File (Concrete,
                 Name ...); -- let's dispatch to the concrete
                            -- Interface
   end Open_File;

   ...   

end OS_Interface;
   


----------------------------------------------------------
package OS_Interface.Windows is
   type Windows_Interface is new Abstract_Interface ...
   -- define abstract operations
   -- redefine some of the concrete operations.
   ...

   procedure Register;
   -- register this one as the concrete interface 
   -- by calling Register_As_Concrete with 
   -- a local dummy instance of Windows_Interface

end OS_Interface.Windows;


For the configuration, you need some separate configuration procedure :

----------------------------------------------------------
separate (Main)
procedure Configure is
begin
   OS_Interface.Windows.Register;
end Configure;


But this is the only compilation unit provided in several versions, the only
one that you need to manage carefully in your configuration system. 
As for conditional compilation systems, some external configuration is
pretty unavoidable.

Note also that calls to (for example) a specific Linux thin binding will be
hidden into the OS_Interface.Linux package : Register is the only operation
in OS_Interface child specification, so if you don't "with" it within the
Configure operation, this code is not included in the executable.

Another advantage is that you don't touch common code when adding or
modifying some specific implementation. You don't cause useless
recompilations or regression testing.

For user code, the whole stuff is hidden : it just call 
OS_Interface.Open_File (Name, ...);
as usual. 

One drawback of this template respect to conditional compilation is an added
indirection and dispatching hidden into OS_Interface body. 
But if someone care of performance at this point, he is in a desperate
situation.

Another drawback is the difficulty to compare implementations, but it's not
that useful, neither that  difficult to do with your favorite environment.

-- 
Lionel Draghi



^ permalink raw reply	[flat|nested] 85+ messages in thread
* Re: Standard Ada Preprocessor (Was: why ada is so unpopular ?)
@ 2004-01-23 20:03 Leon Winslow
  2004-01-24  2:00 ` Marin David Condic
  0 siblings, 1 reply; 85+ messages in thread
From: Leon Winslow @ 2004-01-23 20:03 UTC (permalink / raw)


**** Post for FREE via your newsreader at post.usenet.com ****

I'm interested in knowing why no one has mentioned that 40 years ago the
COBAL language included a statement to specify the machine and/or
operating system for the executable code.  If you wanted the program to
run on a UNIX box, you essentially entered UNIX at the head of the
program; if you wanted it to run on a Windows box you entered Windows.
The rest of the program remained the same.  (Its been a long time since
I used this feature so I don't remember the exact syntax.  Maybe someone
else knows?)

Of course, very few compilers actually implemented more than one
option.  If you wanted a different one, you usually needed a different
compiler.

The important feature however is that the rest of the program was
independent of the machine that would execute the program.  If COBAL
could implement this 40 years ago, why can't we try something similar?


-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 *** Usenet.com - The #1 Usenet Newsgroup Service on The Planet! ***
                      http://www.usenet.com
Unlimited Download - 19 Seperate Servers - 90,000 groups - Uncensored
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=



^ permalink raw reply	[flat|nested] 85+ messages in thread
* why ada is so unpopular ?
@ 2004-01-17 11:15 Szymon Guz
  2004-01-17 14:27 ` Dmytry Lavrov
  0 siblings, 1 reply; 85+ messages in thread
From: Szymon Guz @ 2004-01-17 11:15 UTC (permalink / raw)


Hi,
I'd like to know how ada is popular ? And i which countries. I'm asking 
because I live in Poland and here I couldn't find any firm that use it.

szymon guz




^ permalink raw reply	[flat|nested] 85+ messages in thread

end of thread, other threads:[~2004-02-09 17:37 UTC | newest]

Thread overview: 85+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-26 20:03 Standard Ada Preprocessor (Was: why ada is so unpopular ?) Lionel.DRAGHI
2004-01-26 23:10 ` Robert A Duff
  -- strict thread matches above, loose matches on Subject: below --
2004-01-23 20:03 Leon Winslow
2004-01-24  2:00 ` Marin David Condic
2004-01-17 11:15 why ada is so unpopular ? Szymon Guz
2004-01-17 14:27 ` Dmytry Lavrov
2004-01-17 21:02   ` Szymon Guz
2004-01-17 22:36     ` Adrian Knoth
2004-01-18  9:21       ` Szymon Guz
2004-01-18 12:59         ` Ronald Dauster
2004-01-18 14:17           ` Szymon Guz
2004-01-18 14:42             ` Marin David Condic
2004-01-18 16:34               ` Preben Randhol
2004-01-19 12:59                 ` Marin David Condic
2004-01-19 13:06                   ` Preben Randhol
2004-01-19 13:28                     ` Marin David Condic
2004-01-19 13:37                       ` Preben Randhol
2004-01-20 12:38                         ` Marin David Condic
2004-01-20 17:31                           ` Standard Ada Preprocessor (Was: why ada is so unpopular ?) Warren W. Gay VE3WWG
2004-01-21 12:39                             ` Marin David Condic
2004-01-22  0:05                               ` Robert I. Eachus
2004-01-22  5:59                                 ` Randy Brukardt
2004-01-22 12:58                                   ` Marin David Condic
2004-01-22 17:25                                     ` Warren W. Gay VE3WWG
2004-01-23 12:24                                       ` Marin David Condic
2004-01-23 13:46                                         ` Dmitry A. Kazakov
2004-01-23 17:16                                           ` Warren W. Gay VE3WWG
2004-01-23 17:52                                             ` Jeffrey Carter
2004-01-23 21:57                                               ` Warren W. Gay VE3WWG
2004-01-24  0:52                                                 ` Jeffrey Carter
2004-01-26 17:19                                                   ` Warren W. Gay VE3WWG
2004-01-27 12:24                                                     ` Marin David Condic
2004-01-24  1:34                                                 ` Marin David Condic
2004-01-26 17:27                                                   ` Warren W. Gay VE3WWG
2004-01-27 12:30                                                     ` Marin David Condic
2004-01-24  8:20                                                 ` Pascal Obry
2004-01-26 17:29                                                   ` Warren W. Gay VE3WWG
2004-01-23 17:56                                             ` Larry Hazel
2004-01-24  1:36                                               ` Marin David Condic
2004-01-23 22:14                                             ` Randy Brukardt
2004-01-23 22:42                                               ` tmoran
2004-01-26 17:50                                               ` Warren W. Gay VE3WWG
2004-01-27 12:48                                                 ` Marin David Condic
2004-01-26  9:34                                             ` Dmitry A. Kazakov
2004-01-26 19:23                                               ` Randy Brukardt
2004-01-23  2:47                                     ` Robert I. Eachus
2004-01-23 12:38                                       ` Marin David Condic
2004-01-24  5:23                                         ` Robert I. Eachus
2004-01-24 12:28                                           ` Marin David Condic
2004-01-24 15:32                                             ` Robert I. Eachus
2004-01-24 15:43                                               ` Marin David Condic
2004-01-25  4:24                                                 ` Robert I. Eachus
2004-01-25 16:24                                                   ` Marin David Condic
2004-01-29 11:17                                                 ` Jacob Sparre Andersen
2004-01-29 12:52                                                   ` Marin David Condic
2004-01-26 18:03                                           ` Warren W. Gay VE3WWG
2004-01-27  0:15                                             ` Robert I. Eachus
2004-01-27 22:05                                               ` Warren W. Gay VE3WWG
2004-01-24  8:17                                         ` Pascal Obry
2004-01-24 12:44                                           ` Marin David Condic
2004-01-24 15:39                                             ` Robert I. Eachus
2004-01-24 16:06                                               ` Marin David Condic
2004-01-26 11:28                                             ` Ole-Hjalmar Kristensen
2004-01-26 12:07                                               ` Marin David Condic
2004-01-23 16:38                                       ` Alexandre E. Kopilovitch
2004-01-23 17:54                                         ` Jeffrey Carter
2004-01-23 17:24                                       ` Warren W. Gay VE3WWG
2004-01-23 22:30                                         ` Randy Brukardt
2004-01-26 22:11                                           ` Warren W. Gay VE3WWG
2004-01-27  0:28                                             ` Robert I. Eachus
2004-01-27 22:13                                               ` Warren W. Gay VE3WWG
2004-01-27  1:02                                             ` Jeffrey Carter
2004-01-22 14:13                                   ` Robert A Duff
2004-01-22 17:27                                     ` Warren W. Gay VE3WWG
2004-01-23 12:54                                       ` Marin David Condic
2004-01-23 17:26                                         ` Warren W. Gay VE3WWG
2004-01-23 12:52                                     ` Marin David Condic
2004-01-24  5:52                                       ` Robert I. Eachus
2004-01-24 12:56                                         ` Marin David Condic
2004-01-24 15:53                                           ` Robert I. Eachus
2004-01-30 17:39                                             ` Warren W. Gay VE3WWG
2004-01-31  1:58                                               ` Robert I. Eachus
2004-02-02 17:55                                                 ` Warren W. Gay VE3WWG
2004-02-04 18:36                                                   ` Robert I. Eachus
2004-02-06 17:27                                                     ` Warren W. Gay VE3WWG
2004-02-07 13:18                                                       ` Marin David Condic
2004-02-09 17:37                                                         ` Warren W. Gay VE3WWG
2004-01-30 17:34                                           ` Warren W. Gay VE3WWG
2004-01-22 12:47                                 ` Marin David Condic
2004-01-22 13:24                                   ` Jean-Pierre Rosen
2004-01-22 18:20                                     ` Robert A Duff
2004-01-23  9:18                                       ` Jean-Pierre Rosen
2004-01-23 12:59                                     ` Marin David Condic
2004-01-23 14:21                                       ` Jean-Pierre Rosen
2004-01-24  6:02                                       ` Robert I. Eachus
2004-01-24 13:09                                         ` Marin David Condic
2004-01-24 19:32                                           ` tmoran
2004-01-24 20:34                                             ` Marin David Condic
2004-01-22 17:29                                   ` Warren W. Gay VE3WWG

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