From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: Ada versus Pascal
Date: Fri, 22 Oct 2021 18:12:49 +0300 [thread overview]
Message-ID: <itg2niFeqbnU1@mid.individual.net> (raw)
In-Reply-To: <sku1v7$41p$1@gioia.aioe.org>
On 2021-10-22 12:59, 711 Spooky Mart wrote:
> On 10/22/21 1:18 AM, ldries46 wrote:
>
> [...]
>
>> Ada is stricter
>> than other languages and is meant to have NO Operating system dependant
>> items, so if you cannot go around something there must be a package on
>> each operating system having the same interface everywhere.
>
> By this do you mean the same syntax and libs will run on all target
> systems without fiddling with {IFDEF} and architecture compiler switch
> woo foo for USES and repetitive cross-arch boilerplate?
I'm not ldries46, but here is an answer: Ada standardizes _some_
functions for which some other languages use "OS" services, principally
threading, which in Ada is the "tasking" feature. Indeed Ada tasking
works in the same way whichever OS is used, and also in the "bare
board", no-OS situation. This is very useful for developing
multi-threaded embedded SW, because the Ada tasking code can be tested
on desk-top workstations and then executed on the target system
unchanged. (and no "ifdefs").
But real operating systems (as opposed to simpler real-time kernels)
provide many services that are not standardized in Ada, for example
inter-process communication.
> One thing I can't stand about Pascal is the totally different functions
> and logic from several operating systems that MUST be re-written several
> times in the same code base to do the same job. This drives me mad. In
> fact it irks me so much I was thinking of writing some libraries for
> things I do that would handle this all automatically across arches.
> There would go a couple months of Sundays.
>
> Think IPC with Pascal. Get a good IPC routine going for Linux in your
> app, then you have to re-write it for MAC and Windows, and even some
> other flavors of *nix.
Indeed.
> So am I to understand that the Ada compiler has somehow eliminated this
> problem, by ensuring every target OS has a syntactically conformant
> package to execute its methods using the same statements?
Sadly no.
However, there are some rudiments:
- There is a standardized Ada interface (binding) to POSIX services.
This is implemented in an Ada library called Florist. If you find or
make a Florist implementation for the OSes you use, your Ada program can
use the same OS service interfaces on all those OSes.
- The gcc-based Ada compiler GNAT comes with a GNAT-specific library
that provides some OS services with the same Ada API on any OS that GNAT
supports. This includes some IPC, but I don't know exactly how far that
goes, and the library may of course change from one GNAT version to the
next.
- There is an Ada library called Win32Ada that provides an extensive set
of Microsoft Windows services, but it is a "thin binding" meaning that
even the API is Windows-specific.
The Ada applications I have created and worked with have needed only a
few OS services, basically some IPC: text in and out via pipes to and
from a child process. We implemented our own binding to the required OS
services (pipe and process creation and destruction). The interface
consisted of a package declaration (.ads file) that was basically the
same for all the supported OSes (Windows, Linux, Mac OS X) but had
different OS-specific package body files (implementations, .adb files).
In practice I think the Linux and Mac OS X implementations were the same
and used direct binding to fork() and pipe() etc. The Windows
implementation used Win32Ada.
next prev parent reply other threads:[~2021-10-22 15:12 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-22 3:29 Ada versus Pascal 711 Spooky Mart
2021-10-22 6:18 ` ldries46
2021-10-22 9:59 ` 711 Spooky Mart
2021-10-22 15:12 ` Niklas Holsti [this message]
2021-10-22 15:47 ` Dmitry A. Kazakov
2021-10-23 7:13 ` ldries46
2021-10-23 14:08 ` Simon Wright
2021-10-22 6:40 ` Paul Rubin
2021-10-22 8:57 ` Niklas Holsti
2021-10-22 11:49 ` Jeffrey R.Carter
2021-10-22 17:05 ` Dennis Lee Bieber
2021-10-23 0:29 ` Paul Rubin
2021-10-23 1:17 ` Randy Brukardt
2021-10-23 17:24 ` Dennis Lee Bieber
2021-10-24 7:04 ` J-P. Rosen
2021-10-22 20:00 ` Gautier write-only address
2021-10-24 4:33 ` Jerry
2021-10-24 6:32 ` ldries46
2021-10-24 16:51 ` Gautier write-only address
2021-10-24 23:24 ` 711 Spooky Mart
2021-10-25 8:23 ` Niklas Holsti
2021-10-25 8:40 ` Luke A. Guest
2021-10-25 13:34 ` Luke A. Guest
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox