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=unavailable autolearn_force=no version=3.4.4 X-Received: by 2002:a24:2443:: with SMTP id f64-v6mr895771ita.27.1540506644818; Thu, 25 Oct 2018 15:30:44 -0700 (PDT) X-Received: by 2002:aca:883:: with SMTP id 125-v6mr14264oii.7.1540506644655; Thu, 25 Oct 2018 15:30:44 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.gegeweb.eu!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.166.216.MISMATCH!75-v6no122063itm.0!news-out.google.com!n199-v6ni127itn.0!nntp.google.com!z5-v6no121929ite.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 25 Oct 2018 15:30:44 -0700 (PDT) In-Reply-To: <5b897611-5e95-4bc8-b5b9-a8df97299cd6@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2a04:ae04:9408:b600:590b:eca7:4040:641d; posting-account=HFCrOQoAAABZD_f-UUbYHm3lJDIrh-UX NNTP-Posting-Host: 2a04:ae04:9408:b600:590b:eca7:4040:641d References: <5fb88cf6-47da-4c28-a660-9ddf06522b12@googlegroups.com> <5b897611-5e95-4bc8-b5b9-a8df97299cd6@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <61c2515d-29fd-4b96-8138-88d7f5419fb5@googlegroups.com> Subject: Re: Ada interacting with Windows 8.1+ GUI From: joakimds@kth.se Injection-Date: Thu, 25 Oct 2018 22:30:44 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader02.eternal-september.org comp.lang.ada:54712 Date: 2018-10-25T15:30:44-07:00 List-Id: > Note: Anyhow, I plan on isolating only the type definitions needed to han= dle the window stuff and drop the rest. For me, to bring the whole win32 in= terface is overkill. Isn't it easy for the compiler to optimize away/remove the code that is not= used? Also I can imagine that the packages of the win32 interface is code = that has been written and as a developer one only uses it which means it is= only compiled once and no re-compilation needed. When writing an Ada binding to a C library, consider the following two opti= ons: 1. Put all the source code in a package A. 2. Divide the source code into several packages, for example create an empt= y package A and divide the source code into several child packages A.B, A.C= , A.D, ... Let's imagine there is a type called Window. In solution 1 one writes "A.Wi= ndow" to specify it and in solution 2 one maybe writes "A.D.Window". Solution 1 makes the code less verbose and puts more responsibility on the = compiler to be able to remove unused code. Solution 2 makes the source code= more verbose but makes it easier for an Ada compiler to avoid including un= used source code in the resulting executable. When I have been thinking abo= ut this I've thought "let's assume the compiler is really good and let's go= for minimalistic Ada code". Solution 2 is sometimes advertised as one of t= he selling points of Ada to be able to describe structure of an Ada binding= . Currently I am exploring solution 1 when writing Ada code, but "the ultim= ate way to structure code" is still an open question for me. Best regards, Joakim