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: 109fba,cd8ed9115942852f X-Google-NewGroupId: yes X-Google-Thread: 103376,b92b95c9b5585075 X-Google-NewGroupId: yes X-Google-Attributes: gid4f1905883f,gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!feeder.news-service.com!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: "Jed" Newsgroups: comp.lang.c++,comp.lang.ada Subject: Re: Why use C++? Date: Thu, 11 Aug 2011 05:57:32 -0500 Organization: A noiseless patient Spider Message-ID: References: <1e292299-2cbe-4443-86f3-b19b8af50fff@c29g2000yqd.googlegroups.com> <1fd0cc9b-859d-428e-b68a-11e34de84225@gz10g2000vbb.googlegroups.com> <9ag33sFmuaU1@mid.individual.net> <1d8wyhvpcmpkd.ggiui9vebmtl.dlg@40tude.net> <150vz10ihvb5a.1lysmewa1muz4$.dlg@40tude.net> Injection-Date: Thu, 11 Aug 2011 10:57:20 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="bUZkUS1QLqpHyXuWevVWHQ"; logging-data="14182"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/W7ntpy9ZsPYpUDpUGaOOI" X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6109 X-RFC2646: Format=Flowed; Original X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 Cancel-Lock: sha1:0PD4DyjHiF9LwA1shMQUPLLhrbg= X-Priority: 3 X-MSMail-Priority: Normal Xref: g2news1.google.com comp.lang.c++:82809 comp.lang.ada:20532 Date: 2011-08-11T05:57:32-05:00 List-Id: "Dmitry A. Kazakov" wrote in message news:150vz10ihvb5a.1lysmewa1muz4$.dlg@40tude.net... > On Thu, 11 Aug 2011 03:20:55 -0500, Jed wrote: > >> "Dmitry A. Kazakov" wrote in message >> news:1d8wyhvpcmpkd.ggiui9vebmtl.dlg@40tude.net... >>> On Wed, 10 Aug 2011 17:37:28 -0500, Randy Brukardt wrote: >>> >>>> There are uses for wrapping types, but they are far less likely than >>>> wanting >>>> overflow detection. The default should be to catch errors, not turn >>>> them >>>> into different ones. >>> >>> The OP mentioned image processing, the behavior frequently needed >>> there is >>> saturated integer arithmetic, which is nether ranged nor modular. >>> >>> As for modular types, wrapping is the mathematically correct >>> behavior, >>> it is not an error. >>> >>> You just cannot provide every possible arithmetic at the language >>> level. >>> >> >> What do you think the practical level of limitation is? > > Types that cannot be constructed by the operations of the types algebra > provided by the language. Richer the algebra is, less built-in types > needed. Will you give an example to clarify please? > >> Were you thinking "beyond integers" with your statement? > > There is nothing special in integer types, except that for the types > algebra you need ordinal numerals (i.e. at least one integer type). I know a little bit (enough to "be dangerous") of Intel assembly, and it looks like C/C++ integer types are a direct reflection of what is at that level. Even the fact that by default, integer literals are signed. So in that respect, I think they are special. They are chosen for efficiency as a direct reflection of hardware (I'm not saying all hardware is the same, mind you). > >> What kinds of integer types would >> you like to see built-in to a hypothetical ideal language? > > As little as possible. Usage of predefined integer types makes design > more > fragile. E.g. it is bad when somebody uses Ada's Integer, or C++ int > (OK, > in C++ there is no other option), instead of introducing a type > reflecting > the application semantics rather than the decision of some compiler > vendor > motivated by other concerns. > You have to build those types though based upon the built-in ones, yes? If so, aren't modular, wrapping and overflow-checked equally good for something and all worthy of being in a language? Of course there is signed, unsigned and the different bit widths as candidates also. And are not those built-ins good to use "raw" in many cases? Are you suggesting that a language have NO types? There is assembly language for that (and the instruction set pretty much dictates what types you have to work with at that level).