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!.POSTED!not-for-mail From: "J-P. Rosen" Newsgroups: comp.lang.ada Subject: Re: Build language with weak typing, then add scaffolding later to strengthen it? Date: Fri, 22 May 2015 21:41:11 +0200 Organization: A noiseless patient Spider Message-ID: References: <127b004d-2163-477b-9209-49d30d2da5e1@googlegroups.com> <59a4ee45-23fb-4b0e-905c-cc16ce46b5f6@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Injection-Date: Fri, 22 May 2015 19:40:04 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="2b3884a634d8f846e0712b4e3a92507a"; logging-data="8030"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/bqc+17eclnklFdJ3ixWnB" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 In-Reply-To: <59a4ee45-23fb-4b0e-905c-cc16ce46b5f6@googlegroups.com> Cancel-Lock: sha1:YjP7jMKesVcOfZ6g3Yf/73zvBgU= Xref: news.eternal-september.org comp.lang.ada:25963 Date: 2015-05-22T21:41:11+02:00 List-Id: Le 22/05/2015 19:51, kalvin.news@gmail.com a écrit : > Yes, I understand. I just wanted to make a point here, that an int should not be considered type compatible with another int if they are declared using different typedefs. Neverthless, my argument is still valid if I had used unsigned int, uint16_t or uint32_t: > > typedef uint16_t Cylinder; > typedef uint16_t Head; > typedef uint32_t Sector; > > The variables of type Cyliner, Head and Sector should be treated by > the compiler as incompatible and different types unless they are > explicitly typecasted. Of course, being a long time supporter of strong typing, I agree with that view. But if you think in terms of abstract types and problem domain rather than bits and addresses, don't use C. I see no point in trying to make a low-level language higher level: use a language designed to support higher level views. To take an analogy: nobody would be so fool as to use a language designed for making animations on web pages in a real-time context ;-) -- J-P. Rosen Adalog 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00 http://www.adalog.fr