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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,b92b95c9b5585075 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!feeder3.cambriumusenet.nl!feed.tweaknews.nl!193.201.147.68.MISMATCH!feeder.news-service.com!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.c++,comp.lang.ada Subject: Re: Why use C++? Date: Sat, 13 Aug 2011 11:15:35 +0200 Organization: cbb software GmbH 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> <1q4c610mmuxn7$.1k6s78wa0r8fj.dlg@40tude.net> <1vn800hbyx8k4$.1lsveclj56197$.dlg@40tude.net> <1gu6ni1yb54k3$.4nbvfqqndl8m$.dlg@40tude.net> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: lK/RYS68zGXUV7XS1wGcmQ.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Xref: g2news1.google.com comp.lang.c++:82912 comp.lang.ada:20594 Date: 2011-08-13T11:15:35+02:00 List-Id: On Sat, 13 Aug 2011 02:53:32 -0500, Jed wrote: > "Dmitry A. Kazakov" wrote in message > news:1gu6ni1yb54k3$.4nbvfqqndl8m$.dlg@40tude.net... >> On Fri, 12 Aug 2011 14:06:55 -0500, Jed wrote: >> >>> "Dmitry A. Kazakov" wrote in message >>> news:fwnlcp4mgj03$.1tjeqjtos00o8$.dlg@40tude.net... >> >>>> I want the type semantics specified. C/C++ int is neither lower level nor >>>> closer to the machine it is just ill-defined. The concern is this, not its >>>> relation to the machine, of which I (as a programmer) just do not >>>> care. >>> >>> What more definition do you want? >> >> More than what? I see nothing. > > The semantics of C++ types are specified. By the word "int"? >>> Size guarantee? >>> Other than that, what >>> is ambiguous (platform-specific) about C++ int? >> >> That is one of the meanings of ill-defined. > > Don't use it. Which was the point. >> BTW, if you aim at this application domain, note endianness and encoding >> stuff. You have very little chance that int is the type the protocol or >> hardware uses. > > Picking on int? int, long, unsinged represent an example of wrong language design. The point was that the semantics of an [integer] must be derived from the application domain. >> In each such case I will have to use a type different from the machine >> type. This is just another argument why types need to be precisely >> specified. I addressed this issue above. > > But they are precisely specified on any given platform. 1. They are not. In order to see the specification of int, you have to read the compiler documentation. My point was that the program code does not specify the properties of int. The answer that it is defined somewhere somehow is not an argument at all, anything works in this or that way. 2. I don't care about the platform, I care about what the program is supposed to do. The type's properties shall be defined by the application domain. >> Just another layer of >> abstraction above states of the p-n junctions of some transistors. Do >> you care? > > At some level, I care, yes. At that level, no. I'm not against your > proposal, I just don't know the scope of it. I have a feeling that going > to the level you are calling for is what would say is "an exercise" > instead of practical engineering. Just a feeling though, mind you. Tell > me this, how close is Ada (and which one) to your ideal? All I know about > Ada is what I've read about it. Maybe I should write some programs in it. Ada is close, but not close enough. It is light years ahead of C++ concerning numeric types, so the problems with Ada might be difficult to understand for a C programmer. Ada puts too much magic into numeric types. I would prefer less. Ada lacks numeric interfaces abstracted away. Ada lacks mapping of classes of numeric types onto proper types. [There are classes, but no objects] Exceptions are not contracted. Too many things required static. Other things are dynamic while should have been static, etc. >>>>>> (The way compiler would implement that type is uninteresting, >>>>> >>>>> Ha! To me that is KEY. >>>> >>>> This is not a language design question. It is a matter of compiler >>>> design targeting given machine. >>> >>> Oh? I've been having a language design discussion (primarily). >> >> Then that cannot by any means be a key issue. > > That's opinion, not fact. It is a conclusion from the fact that we were discussing language design issues rather than code generation problems. >>>> Why should you? Again, considering design by contract, and attempt to >>>> reveal the implementation behind the contract is a design error. You shall >>>> not rely on anything except the contract, that is a fundamental >>>> principle. >>> >>> While that paradigm does have a place, that place is not "everywhere". >> >> Where? > > The formality of "design by contract" as used in developing > functions/methods. That is a procedural view on software developing [a very outdated one, IMO]. But design by contract is a mere engineering principle, it applies absolutely everywhere in engineering. If you disagree, please, show examples. [I don't mean here Meyer's notion of DbC, which is largely wrong, IMO] >>> Well then, if wrapping is OK, what else is needed and why? >> >> Wrapping is an implementation, the question is WHAT does this >> implementation actually implement? > > I was just asking why you find that inadequate such that something > (largely more complex?) is needed. Hmm, then I didn't understand your question. > Oh, you were thinking something else when I wrote: "Can that be achieved? > At what degree of complexity?". I asked if creating your ideal language > (this "definitively specified higher level" language) is feasible and if > so, what does that do to the complexity of the implemenation (compiler)? I think it should make the compiler simpler. Implementation of the RTL is a different issue. > Is a comparison of Ada and C++ pretty much that answer? As a matter of fact, since I partially did both, to compile Ada is way simpler than to compile C++. >> Contract specifications. "int" is not a contract. > > Does Ada meet your desired requirements? Ada is the closest existing approximation. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de