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 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!gandalf.srv.welterde.de!news.jacob-sparre.dk!loke.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Running a preprocessor from GPS? Date: Thu, 30 Jul 2015 14:32:15 -0500 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <2df4698f-4c8e-457c-822d-209cb2f8ab5e@googlegroups.com> <014427b1-ff7a-4a69-82e6-0330af77ed96@googlegroups.com> NNTP-Posting-Host: rrsoftware.com X-Trace: loke.gir.dk 1438284736 26983 24.196.82.226 (30 Jul 2015 19:32:16 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Thu, 30 Jul 2015 19:32:16 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Xref: news.eternal-september.org comp.lang.ada:27240 Date: 2015-07-30T14:32:15-05:00 List-Id: "EGarrulo" wrote in message news:d5a73210-a67f-4d21-8b16-536af10ab157@googlegroups.com... > On Wednesday, July 29, 2015 at 10:32:16 PM UTC+2, Randy Brukardt wrote: ... >> In Ada terms, typing is something done at compile-time. Ada does not have >> runtime typing (one could imagine tag checks to be runtime typing, but >> that's a check in Ada, not related to typing). > > But is this a valid excuse? Aren't programming languages supposed to > let programmers write useful programs? Within the language philosophy. If writing *your* useful programs is too hard, then you are probably using the wrong language (or you need some re-education, which I think applies more to the current case ;-). ... > If Ada offered runtime typing by means of a type `Any`, then `Printf` > could be trivially written as: > > type Printf_Arguments is array (Positive range <>) of Any; > > procedure Printf (Format : String; Arguments : Printf_Arguments); Surely, at the cost of all compile-time checking (because there isn't any). And there couldn't be any useful runtime checking, either (at least not unless Ada added Multiple Inheritance, which is unlikely), so such a construct would be unsafe. (Exactly how unsafe depends on the capabilities of the format string.) ... >> > Generics *are* glorified macros anyway, in a sense. >> >> This is an especial sore point with me! >> >> Formally in the Ada RM they are, which causes all manner of nonsense >> effects >> which then get erased by special rules. Stupid. > > What do you mean? Conceptually, generics are macros. Definitely not; that's the problem that programmers with extensive C++ knowledge don't understand, because they *are* macros in C++. But in Ada, the contents of the source text is not what gets duplicated (even though the RM mistakenly describes it that way -- definitely a sore point with me). Niklas explained the model in far more detail, so I won't repeat it here -- but the "generic contract" is considered critically important to the language design (just like avoiding privacy violations is). It is very unlikely that we would ever allow anything that would make an Ada generic work like a macro. Randy.