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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b30bd69fa8f63cb2 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-06-12 18:32:35 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!wn13feed!worldnet.att.net!bgtnsc05-news.ops.worldnet.att.net.POSTED!not-for-mail Newsgroups: comp.lang.ada Subject: Re: C bug of the day From: James Rogers References: <1054751321.434656@master.nyc.kbcfp.com> <82347202.0306101232.16776a81@posting.google.com> Message-ID: User-Agent: Xnews/5.04.25 Date: Fri, 13 Jun 2003 01:32:35 GMT NNTP-Posting-Host: 12.86.32.251 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc05-news.ops.worldnet.att.net 1055467955 12.86.32.251 (Fri, 13 Jun 2003 01:32:35 GMT) NNTP-Posting-Date: Fri, 13 Jun 2003 01:32:35 GMT Organization: AT&T Worldnet Xref: archiver1.google.com comp.lang.ada:39073 Date: 2003-06-13T01:32:35+00:00 List-Id: kanze@gabi-soft.fr wrote in news:d6652001.0306120439.75bdfe78@posting.google.com: > James Rogers wrote in message > news:... >> kanze@gabi-soft.fr wrote in >> news:d6652001.0306110131.6ac9e693@posting.google.com: > >> I do not think you will get any significant resistance to the idea >> that Ada is imperfect. If you look through the current list of >> threads in comp.lang.ada you will find a number of suggestions for >> improving the language. > > That's good news. I know that when I was using Java, you could get > seriously flames in comp.lang.java.programming just for suggesting > that the language wasn't perfect. > >> You will also probably see that few of these suggestions are focused >> on improving fundamental Ada safety. Most are focused on ways to make >> Ada more popular. > > Obviously, you concentrate on the most important problems first:-). > Good luck. (I rather doubt that a language can be both safe and > popular. History, at any rate, is against you.) > I agree about history. >> I assert that it is impossible to develop a universally perfect >> language. Different problem domains require different language >> strengths. I do not, for instance, believe a single language can >> satisfy all the requirements of a scripting language while >> simultaneously satisfying all the needs of an embedded language used >> in SIL-4 level applications. > > Exactly. And in some cases, my opinion as to what the safe default is > may not agree with yours. If your argument is that it is > significantly easier to write a robust application in Ada than in C++, > all that I have been able to find out about the language without > actually using it makes me think that you are right. If you try to > claim that it is impossible to write an incorrect program without > overriding a default behavior, on the other hand... Heavens no. Ada cannot determine if you are using the wrong algorithm. It does, however, provide the syntax to allow you to express your design very accurately and efficiently. This in turn gives the compiler a better understanding of your design. That understanding allows the compiler to flag problems only revealed during debugging in C and C++. The following is a simple example of extra design information in a program: with Ada.Text_IO; procedure Simple_Example is type Days is (Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday); package Day_IO is new Ada.Text_IO.Enumeration_IO(Days); today : Days; begin Ada.Text_IO.Put("Enter the name of the current day: "); Day_IO.Get(today); if today in Monday..Friday then Put_Line("Go to work."); else Put_Line("Go Fishing."); end if; end Simple_Example; I instantiate the generic package Ada.Text_IO.Enumeration_IO with the type Days. This creates an I/O package that allows a user to type in any value in the Days type as input. That value will be converted to the corresponding enumeration value and assigned to the variable "today". I can then check the value in the variable using a range notation. Ada generics are similar to C++ templates. Jim Rogers