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 19:23:18 -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 1438302199 13918 24.196.82.226 (31 Jul 2015 00:23:19 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Fri, 31 Jul 2015 00:23:19 +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:27250 Date: 2015-07-30T19:23:18-05:00 List-Id: "EGarrulo" wrote in message news:d3142cab-776d-4daa-8475-1dd4d46d8556@googlegroups.com... > On Thursday, July 30, 2015 at 9:32:17 PM UTC+2, Randy Brukardt wrote: ... >> And there couldn't be any useful runtime checking, either > > Why not? Please explain me why this is acceptable: > > -- This conversion will fail if Some_Integer is bigger than what > -- Constrained_Integer_Type can hold. > Some_Constrained_Integer := Constrained_Integer_Type (Some_Integer); > > whilst this is not: > > -- This conversion will fail if Any doesn't contain an Integer. > Some_Integer := Integer (Any); > > I don't see any difference. Both conversions can fail at runtime because > types > don't match. This is the same nonsense that Dmitry has been spouting. In the first instance, you have the *same* types with different constraints (ranges in this case). Ranges *might* be checked at rumtime, although Ada compilers spend an enormous amount of effort into checking them at compile-time (so there is no overhead). The second case is a mapping of actual different types. That would require some sort of runtime type representation, which would imply a lot of overhead for elementary types (as the runtime type representation would be larger than the type itself in many cases). Additionally, elementary types are by-copy; that would prevent the techniques used for tagged types from working. Most likely, one would have to add a level of indirection into most objects. That sort of distributed overhead is typically frowned on in Ada. Indeed, if the second case was allowed in Ada, it definitely would NOT represent different types. The check would be some sort of constraint check (similar to the tag check of tagged types). "Any" would represent any type, and thus would never fail type matching. Randy.