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=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,42e401e32683b965 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!news3.google.com!feeder.news-service.com!188.40.43.213.MISMATCH!feeder.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: "J-P. Rosen" Newsgroups: comp.lang.ada Subject: Re: A new notion: stronglly-typed-by-user language Date: Sat, 17 Apr 2010 20:57:12 +0200 Organization: Adalog Message-ID: References: <57119c7d-eb78-4904-a2de-bf183b03ccf0@r18g2000yqd.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Injection-Date: Sat, 17 Apr 2010 18:57:16 +0000 (UTC) Injection-Info: feeder.eternal-september.org; posting-host="BmMjSWM6MlrJGoGdUj30Hw"; logging-data="22840"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19wgbvfcIIgtSeHw0NVcmbu" User-Agent: Thunderbird 2.0.0.24 (Windows/20100228) In-Reply-To: <57119c7d-eb78-4904-a2de-bf183b03ccf0@r18g2000yqd.googlegroups.com> Cancel-Lock: sha1:tbPuBlyWGfOTIr2yjuMx9DHQem0= Xref: g2news2.google.com comp.lang.ada:11016 Date: 2010-04-17T20:57:12+02:00 List-Id: Maciej Sobczak a �crit : > On 17 Kwi, 07:25, "J-P. Rosen" wrote: > >>> http://www.msobczak.com/prog/typegen/ >> This shows that an educated Ada programmer, well aware of the issues of >> strong typing, can mimmic the same behaviour in C++. But how many C++ >> programmers use that? > > Not many, but that does not matter in this discussion - we are > discussing the language, not programmers. Precisely. You showed you can add type safety to the language - which means that there is not built-in type safety. >>> I don't see how type promotion violates the strong type safety. >> Type promotion is based on the underlying representation, not on >> abstract types. > > No. Type promotions in C++ are defined in terms of values, not in > terms bit patterns. There is nothing that forces char and int to have > similar underlying representation, yet promotion from char to int is > well-defined. Here is what I had in mind. If you have: void p (short S); void p (long L); and you call p (I) where I is an int, it will resolve to the first one if short and int are the same, and to the second one if long and int are the same. This is logical in terms of machine types, but the idea that overloading resolution (and the associated promotion) depends on the implementation will make any Ada lawyer faint ;-) > >> And it is a form of automatic type case - which is cast - typo! >> always a bad idea IMHO. > > There are many bad ideas in C++. I don't see how this one affects > strong type safety. See above -- --------------------------------------------------------- J-P. Rosen (rosen@adalog.fr) Visit Adalog's web site at http://www.adalog.fr