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.3 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,103b407e8b68350b X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-01-05 17:38:04 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!arclight.uoregon.edu!wn14feed!wn12feed!worldnet.att.net!199.45.49.37!cyclone1.gnilink.net!news-out.nuthinbutnews.com!propagator2-sterling!news-in-sterling.newsfeed.com!fr.usenet-edu.net!usenet-edu.net!enst.fr!not-for-mail From: "Robert C. Leif" Newsgroups: comp.lang.ada Subject: RE: Anybody in US using ADA ? One silly idea.. Date: Sun, 5 Jan 2003 17:37:22 -0800 Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Trace: avanie.enst.fr 1041817083 41933 137.194.161.2 (6 Jan 2003 01:38:03 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Mon, 6 Jan 2003 01:38:03 +0000 (UTC) Return-Path: X-Envelope-From: rleif@rleif.com X-Envelope-To: X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.4510 Importance: Normal In-Reply-To: X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.13 Precedence: bulk List-Unsubscribe: , List-Id: comp.lang.ada mail<->news gateway List-Post: List-Help: List-Subscribe: , Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:32593 Date: 2003-01-05T17:37:22-08:00 I disagree! A very simple construct is a generic set of types and = objects that are also part of a private tagged record. This structure can be extended and manipulated. For instance, when dealing with hardware, = Intel input-output registers and memory locations can be 8, 16, and 32 bits. A generic is a simple way to model this. In fact if it were possible, I = would greatly prefer generic constructs to pointers. I must note that generics = can be instantiated at run-time and, I believe, still be located on the = heap. No need for garbage collection. Oberon.NET, which is very new, has = generics. Bob Leif -----Original Message----- From: comp.lang.ada-admin@ada.eu.org = [mailto:comp.lang.ada-admin@ada.eu.org] On Behalf Of Dmitry A. Kazakov Sent: Sunday, January 05, 2003 6:13 AM To: comp.lang.ada@ada.eu.org Subject: Re: Anybody in US using ADA ? One silly idea.. Hillel Y. Sims wrote: > "Dmitry A. Kazakov" wrote in message > news:av6hla$cggao$1@ID-77047.news.dfncis.de... >> Kevin Cline wrote: >> >> > Today, the features that Ada provides have little value >> > compared with the features that C++ provides and Ada lacks: >> > the STL, automatic template function instantiation, >> >> Generics in any form is an illness of programming languages. >=20 > As someone who uses C++ template functionality extensively, I find = that a > very odd statement and completely inconsistent with my own experience. = Can > you provide some rationale? In short generics is a meta language and no more than dressed macros = used to patch the source code. More elaborated: 1. Generics are static. You cannot have an object or dynamic-link = library of generics. 1.a. This kills code reuse at run-time. 1.b. You cannot have a true polymorphism with generics. [A fake, = "static"=20 polymorphism was invented to hide the truth.] 1.c. You have geometric code size explosion if you consequently use=20 generics. 2. You have no ADT with generics. All generic types are hard-wired. In = C++=20 you have only one generic type: "class". In Ada there are few: = "private",=20 "range <>" etc. This is Stone Age. Theoretically one could leverage=20 generics to full ADT, but what for? It is much better to have a better = ADT=20 in the core language and abadon generics. 3. Generics are inconsistent with type relationships. When you = instantiate=20 something, this something is absolutely unrelated to everything else. A=20 generic container instantiated with a subtype will never become a = subtype=20 of same container instantiated with the base type. 4. Generics are inconsistent with DbC. In C++ you just instantiate and = pray. In Ada it is better, but still you have reemergence of predefined=20 operations and other contract violations. The reason is clear, while the = core language operates with types and their relations, generics are sort = of: let's substitute one string for another and see if the result go=20 through the compiler. I think it was Kernigan and Ritchie who said that=20 preprocessor does not know C. Substitute generics for preprocessor and=20 language X for C. 5. Generics are unstructured and too powerful. They are comparable with=20 gotos. Gotos arbitrarely change control flow. Generics arbitrarely = produce=20 new language objects. You can have a generic type, subroutine, package,=20 everything. The consequences of an instantiation is almost impossible to = predict. As with gotos, you should admit, that a program with generics = is=20 very difficult to understand and maintain. [For C++ replace difficult to = impossible, because of automated instantiation] 6. Generics completely fall out of the language, because in fact they = form a meta-langauge. A generic object does not exist for the core language. = What=20 could be done with a generic object? The answer is: nothing. One cannot=20 pass a generic function as a parameter to a normal function. Even a = generic=20 parameter cannot be generic (:-)), only instances [=3D objects of the = core=20 language] are allowed. So even as a meta-language, generics represent an = inconsistent one. ------------------------ A little of bad philosophy as a conclusion. (:-)) If we consider the=20 evolution of programming languages, we could note maybe unconscious, but = constant and very successfull attempts to solve the problem of=20 parametrization in a more civilized way than just by brute force of=20 preprocessing =3D generics. A subroutine is parametrized by the values of the arguments [FORTRAN] A subroutine is a value which can be a parameter [?] A type is parametrized by the values of the discriminants [Ada 83] A type set (=3Dclass-wide type) is parametrized by a type (=3Dtype tag) = [OOPL=20 with dispatching] In the end of this process we will need generics as much as we need = gotos=20 now. --=20 Regards, Dmitry A. Kazakov www.dmitry-kazakov.de