Re: No call for Ada (was Re: Announcing new scripting/prototyping language)

Discussion in 'C++' started by Ludovic Brenta, Feb 7, 2004.

  1. "Carroll-Tech" <> writes:

    > I tell the students that I tutor that learning some Pascal or Ada
    > would help them and they get scared. I mention doing a project in
    > Ada and everyone looks at me like I'm out to punish myself. To me
    > it isn't any easier to use C/C++, Java, Perl, Lisp or Prolog than it
    > is to use Ada. How is it that Ada has this "super powerful", "super
    > difficult", "there's not much call for it because it's too advanced
    > and powerful" air about it when it's just another language? It's
    > like saying that the machine code spit out of an Ada compiler has
    > some mystical, magical properties that makes the Ada language more
    > difficult to use.


    I was thinking along the same lines last evening, and I came up with a
    small theory that explains why so few pople can be bothered to learn
    Ada. It goes like this: There are 3 types of languages.

    The first type of language says "we're going to make programming
    easy". Of course, this is a lie, because programming is inherently
    difficult and no language can make it easy. These languages fake it
    by being simplistic. Java is the most prominent member of this family
    of languages; most scripting languages also fall in this category.
    Beginners tend to flock to these "easy" languages and never learn
    proper programming skills (like e.g. memory management. If some Java
    "guru" reads this, ask yourself this one question: how many threads
    does your program have, and please justify the existence of each
    thread).

    The second type says "we will let you do anything, absolutely anything
    you want, and the power is in the hands of the True Programmers".
    Languages in this category include, among others, C and C++. Many
    people take a foolish pride in being called a True Programmer, and
    therefore like these languages. I myself once was in this category: I
    would show off my skills by writing a single-line program that nobody
    else could read. But humans write bugs, and these languages don't
    lend a hand finding these. Hence the famous buffer overflows.

    The third type is what I would call the "zen master" type of
    languages. They treat you like an apprentice, slapping you on the
    hand each time you make a small mistake, and they scorn at you for
    choosing the quick and easy path -- which leads to the Dark Side. If
    you accept their teachings, you quickly become a Master yourself. If
    you rebel against them, you will never achieve Enlightenment and will
    always produce bugs. The "zen master" languages are Pascal, Modula,
    Oberon, and, master of masters, Ada. The beauty of these languages is
    that, once you are Enlightened, you can apply your wisdom to other
    languages as well -- but often would prefer not to.

    --
    Ludovic Brenta.
     
    Ludovic Brenta, Feb 7, 2004
    #1
    1. Advertising

  2. Re: No call for Ada (was Re: Announcing new scripting/prototypinglanguage)

    Ludovic Brenta wrote:
    > "Carroll-Tech" <> writes:
    >
    >
    >>I tell the students that I tutor that learning some Pascal or Ada
    >>would help them and they get scared. I mention doing a project in
    >>Ada and everyone looks at me like I'm out to punish myself. To me
    >>it isn't any easier to use C/C++, Java, Perl, Lisp or Prolog than it
    >>is to use Ada. How is it that Ada has this "super powerful", "super
    >>difficult", "there's not much call for it because it's too advanced
    >>and powerful" air about it when it's just another language? It's
    >>like saying that the machine code spit out of an Ada compiler has
    >>some mystical, magical properties that makes the Ada language more
    >>difficult to use.

    >


    I don't know. Ada rocks.

    /David
     
    David Rasmussen, Feb 7, 2004
    #2
    1. Advertising

  3. Ludovic Brenta

    David Harmon Guest

    On 07 Feb 2004 14:00:35 +0100 in comp.lang.c++, Ludovic Brenta
    <> was alleged to have written:
    >Newsgroups: comp.lang.ada,comp.lang.c,comp.lang.c++,comp.lang.java


    You damned crossposting troll, there is _no_ subject on-topic in all
    those newsgroups.

    See the welcome message posted twice per week in comp.lang.c++ or
    available at http://www.slack.net/~shiva/welcome.txt
     
    David Harmon, Feb 7, 2004
    #3
  4. Re: No call for Ada (was Re: Announcing new scripting/prototypinglanguage)

    Ludovic Brenta wrote:

    > The third type is what I would call the "zen master" type of
    > languages. They treat you like an apprentice, slapping you on the
    > hand each time you make a small mistake, and they scorn at you for
    > choosing the quick and easy path -- which leads to the Dark Side. If
    > you accept their teachings, you quickly become a Master yourself. If
    > you rebel against them, you will never achieve Enlightenment and will
    > always produce bugs. The "zen master" languages are Pascal, Modula,
    > Oberon, and, master of masters, Ada. The beauty of these languages is
    > that, once you are Enlightened, you can apply your wisdom to other
    > languages as well -- but often would prefer not to.


    I think you are on the right track. When I am programming in Ada, I
    often spend most of a day coding. If I am exhausted at the end of it, I
    will put off compiling until the next day. Otherwise, I hand all the
    code to the compiler, and I am not surprised to be handed back dozens of
    error messages. Fix the syntax bugs, and now I get twices as many
    semantic errors. Kill all those and I am surprised if the test
    programs--often written between the package interface and the package
    bodies--don't run correctly.

    For example, I recently finished writing a library of matrix operations
    which works with "views" that may be a submatrix of an existing matrix,
    and supports operations like Add(A,B) where the result is written in A.
    That's a bit tricky, but the real complex one is Mult(A,B) where the
    amount of temporary storage space for two N by N matricies is N. (A
    buffer that stores one row.)

    Why am I mentioning this? After all the coding I had a bug in the Mult
    routine that the compiler didn't catch. A wrong subscript inside a
    loop. (Why am I doing this? To submit as a new benchmark for SPECfp.
    All that stuff is just scaffolding for implementing Strassen's algorithm
    efficiently.)

    Since I don't take what the compiler tells me personally, I love the
    ratio of a hundred to one or so between compile errors and run-time
    bugs. Some people though look at a list of compiler error messages as
    if each one was a major failing on their part. Me? I could proofread
    the code carefully, but it is easier to let the compiler find out where
    I typed a comma for a period, and so on. And IMHO it would be nice if
    the compiler found all the typos, not just most of them. ;-)

    Could I write the same code in C, C++, or Java? Sure. It is just much
    easier to let the Ada compiler do the heavy lifting part of the
    debugging, so I would still write in Ada, then modify the code to match
    the C, C++, or Java syntax. So to me, all that frequent hand-slapping
    is a major benefit.

    --
    Robert I. Eachus

    "The war on terror is a different kind of war, waged capture by capture,
    cell by cell, and victory by victory. Our security is assured by our
    perseverance and by our sure belief in the success of liberty." --
    George W. Bush
     
    Robert I. Eachus, Feb 7, 2004
    #4
  5. Ludovic Brenta

    MSG Guest

    Ludovic Brenta <> wrote in message news:<>...

    [...]

    > The "zen master" languages are Pascal, Modula,
    > Oberon, and, master of masters, Ada. The beauty of these languages is
    > that, once you are Enlightened, you can apply your wisdom to other
    > languages as well -- but often would prefer not to.



    Can you do the following in Ada:

    1. Write *one* bubble-sort function that will work on different
    types given an appropriate comparison function

    2. If B is a subtype of A, can you pass it to any function that
    takes A as an argument? (covariance)

    3. If B is a subtype of A, and FA and FB are functions accepting A
    and B as arguments, can you use FA wherever FB could be used?
    (contravariance)

    4. If B is a subtype of A, is list/array/vector/set/etc. of Bs a
    subtype of list/array/vector/set/etc of As? (covariance)

    Unless you can show us how to do this in a way that will keep Ada a
    "safe" (third category) language you say it is, I will not believe
    that it's a "master of of the masters", I'm afraid.

    If you answer "yes" to any of the questions, post *compilable*
    snippets: we don't want to learn Ada just to verify your claims,
    we simply won't believe you.

    BTW, the esteemed Mr. E. Robert Tisdale (ER for short) isn't
    letting on about why Ada isn't used much at NASA any more.
    Perhaps *you* have an explanation?

    MSG
     
    MSG, Feb 7, 2004
    #5
  6. Re: No call for Ada (was Re: Announcing new scripting/prototypinglanguage)

    MSG wrote:
    >
    > Unless you can show us how to do this in a way that will keep Ada a
    > "safe" (third category) language you say it is, I will not believe
    > that it's a "master of of the masters", I'm afraid.
    >
    > If you answer "yes" to any of the questions, post *compilable*
    > snippets: we don't want to learn Ada just to verify your claims,
    > we simply won't believe you.
    >
    > BTW, the esteemed Mr. E. Robert Tisdale (ER for short) isn't
    > letting on about why Ada isn't used much at NASA any more.
    > Perhaps *you* have an explanation?
    >


    So you have theories about Ada, but you don't really know it? That's
    credible...

    Just for the record: I am posting from comp.lang.c++.

    /David
     
    David Rasmussen, Feb 7, 2004
    #6
  7. (MSG) writes:
    > If you answer "yes" to any of the questions, post *compilable*
    > snippets: we don't want to learn Ada just to verify your claims,
    > we simply won't believe you.


    Feel free to post compilable Ada snippets in comp.lang.ada, but please
    don't cross-post to comp.lang.c, comp.lang.c++, or comp.lang.java.
    The last thing any of these newsgroups needs is yet another language
    flame war. (I'm posting from comp.lang.c.)

    I've redirected followups to comp.lang.ada.

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    San Diego Supercomputer Center <*> <http://www.sdsc.edu/~kst>
    Schroedinger does Shakespeare: "To be *and* not to be"
     
    Keith Thompson, Feb 7, 2004
    #7
  8. Ludovic Brenta

    Guest

    >4. If B is a subtype of A, is list/array/vector/set/etc. of Bs a
    > subtype of list/array/vector/set/etc of As? (covariance)

    What do you mean by a "set" being a "subtype" of another "set"?
     
    , Feb 7, 2004
    #8
  9. On Sat, 07 Feb 2004 14:00:35 +0100, Ludovic Brenta wrote:

    > Of course, this is a lie, because programming is inherently
    > difficult and no language can make it easy.


    That's exactly what the assembly language programmers said about the
    first Fortran compiler, and it's equally wrong now. Sure, there are cases
    where you need to run DSP code and coordinate with the home base thirty
    million miles away using one space-hardened 386, and that's hard. Then
    there's the cases where you need two lines of shell to simplify moving
    files around, and that's something assembly or Fortran or Ada or Java
    would make much more complex then it is.

    > (like e.g. memory management. If some Java
    > "guru" reads this, ask yourself this one question: how many threads
    > does your program have, and please justify the existence of each
    > thread).


    In the Jargon file, there's a story of a man who bummed every cycle out of
    a poker program, even the initialization code, who spurned assembly
    language because it was too inefficient. How would you explain your choice
    of programming language to him? Who cares if there's a couple extra
    threads running? You make a big deal about languages that protect you
    against buffer overflows, why not use a language that protects you against
    memory leaks?

    > The "zen master" languages are Pascal, Modula,
    > Oberon, and, master of masters, Ada.


    Pascal is hardly usable, unless you use one of a dozen proprietary
    extensions. That's hardly "zen master".
     
    David Starner, Feb 8, 2004
    #9
  10. Re: No call for Ada (was Re: Announcing new scripting/prototypinglanguage)

    David Starner wrote:

    > On Sat, 07 Feb 2004 14:00:35 +0100, Ludovic Brenta wrote:
    >
    >
    >>Of course, this is a lie, because programming is inherently
    >>difficult and no language can make it easy.

    >
    >
    > That's exactly what the assembly language programmers said about the
    > first Fortran compiler, and it's equally wrong now. Sure, there are cases
    > where you need to run DSP code and coordinate with the home base thirty
    > million miles away using one space-hardened 386, and that's hard. Then
    > there's the cases where you need two lines of shell to simplify moving
    > files around, and that's something assembly or Fortran or Ada or Java
    > would make much more complex then it is.
    >
    >
    >>(like e.g. memory management. If some Java
    >>"guru" reads this, ask yourself this one question: how many threads
    >>does your program have, and please justify the existence of each
    >>thread).

    >
    >
    > In the Jargon file, there's a story of a man who bummed every cycle outof
    > a poker program, even the initialization code, who spurned assembly
    > language because it was too inefficient. How would you explain your choice
    > of programming language to him? Who cares if there's a couple extra
    > threads running? You make a big deal about languages that protect you
    > against buffer overflows, why not use a language that protects you against
    > memory leaks?


    "Who cares it there's an extra couple of threads running?" you ask.
    I do! I work on systems which are required to process thousands
    of requests per second. Unnecessary threads (just because the language
    makes it easy to create them), waste precious CPU cycles. (But that's
    OT in c.l.c, I think).

    If your last statement refers to Java protecting you against memory
    leaks, then you have a surprise in store for you.
    If it protects you against memory leaks why is there a need for
    a garbage collector in the first place?
    I have found many situations where the garbage collector did
    not clear unused memory. The garbage collector is just as
    buggy as any other code. (This is also OT in the c.l.c group.
    and I don't want to subsribe to c.l.java :)



    >
    >
    >>The "zen master" languages are Pascal, Modula,
    >>Oberon, and, master of masters, Ada.

    >
    >
    > Pascal is hardly usable, unless you use one of a dozen proprietary
    > extensions. That's hardly "zen master".
    >


    --
    Ñ
    "It is impossible to make anything foolproof because fools are so
    ingenious" - A. Bloch
     
    Nick Landsberg, Feb 8, 2004
    #10
  11. Ludovic Brenta

    Simon Wright Guest

    "Robert I. Eachus" <> writes:

    > I think you are on the right track. When I am programming in Ada, I
    > often spend most of a day coding. If I am exhausted at the end of it,
    > I will put off compiling until the next day. Otherwise, I hand all
    > the code to the compiler, and I am not surprised to be handed back
    > dozens of error messages. Fix the syntax bugs, and now I get twices
    > as many semantic errors.


    I don't know if I'm just too impatient, but I much prefer to implement
    each subprogram body and then compile it (they are usually separates,
    so GNAT is quite happy do do this from within Glide).

    If nothing else, it means that any problems with specs or
    inter-package relationships appear earlier.

    > Kill all those and I am surprised if the
    > test programs--often written between the package interface and the
    > package bodies--don't run correctly.


    --
    Simon Wright 100% Ada, no bugs.
     
    Simon Wright, Feb 8, 2004
    #11
  12. Ludovic Brenta wrote:

    > Not automatically. You would define new containers explicitly for A
    > and B, using generics; see for example the Booch components[1] or the
    > Charles library[2], which is modelled after the C++ STL. If you want
    > polymorphic containers, you store pointers in them.


    > [1] http://www.pogner.demon.co.uk/components/bc/case-study.html
    > [2] http://home.earthlink.net/~matthewjheaney/charles/


    AdaCL (adacl.sf.net) has polymorphic containers whichout (exposed) pointers
    - that is somthing C++ can't do ;-) because C++'s RTTI is only a cheap
    excuse compared with Ada's tags.

    For the C++ programmes: If you copy contruct a class in Ada then Ada will
    use the tag of the class to determine the actual child class and copy that
    instead of the currently visible prarent view of the class.

    With Regards

    Martin
    --
    mailto://
    http://www.ada.krischik.com
     
    Martin Krischik, Feb 8, 2004
    #12
  13. MSG wrote:

    > Ludovic Brenta <> wrote in message
    > news:<>...
    >
    > [...]
    >
    >> The "zen master" languages are Pascal, Modula,
    >> Oberon, and, master of masters, Ada. The beauty of these languages is
    >> that, once you are Enlightened, you can apply your wisdom to other
    >> languages as well -- but often would prefer not to.

    >
    >
    > Can you do the following in Ada:
    >
    > 1. Write *one* bubble-sort function that will work on different
    > types given an appropriate comparison function


    Shure you can. Ada invented templates long bevore C++ was even though of.
    Ada templates are far more powerfull then C++.

    > 2. If B is a subtype of A, can you pass it to any function that
    > takes A as an argument? (covariance)


    subtype as in object orientation:

    type Parent is tagged null record;
    type Child is new Parent with null record;

    or subtype as in simple types:

    type Day_of_Month is range 1 .. 31;
    subtype Day_of_Febuary is Day_of_Month range 1 .. 29;

    Well, the answer is yes in both cases.

    > 3. If B is a subtype of A, and FA and FB are functions accepting A
    > and B as arguments, can you use FA wherever FB could be used?
    > (contravariance)


    Of corse.

    > If you answer "yes" to any of the questions, post *compilable*
    > snippets: we don't want to learn Ada just to verify your claims,
    > we simply won't believe you.


    Others did that allready. Besides, you would need an installed Ada compiler
    to verify anyway.

    > BTW, the esteemed Mr. E. Robert Tisdale (ER for short) isn't
    > letting on about why Ada isn't used much at NASA any more.


    He also won't tell you why Spirit died.

    With Regards

    Martin

    --
    mailto://
    http://www.ada.krischik.com
     
    Martin Krischik, Feb 8, 2004
    #13
  14. On Sun, 08 Feb 2004 14:05:53 +0100, Martin Krischik wrote:

    > MSG wrote:
    >
    >> Can you do the following in Ada:
    >>
    >> 1. Write *one* bubble-sort function that will work on different
    >> types given an appropriate comparison function

    >
    > Shure you can. Ada invented templates long bevore C++ was even though of.


    Factoid: Alex Stepanov started off his research that led to the STL in Ada.

    > Ada templates are far more powerfull then C++.


    Why do you say that? I haven't used Ada terribly much, but from what I
    remember, I don't think Ada generics are Turing-complete, which C++
    templates are.

    Josh
     
    Josh Sebastian, Feb 8, 2004
    #14
  15. Josh Sebastian wrote:

    > On Sun, 08 Feb 2004 14:05:53 +0100, Martin Krischik wrote:
    >
    >> MSG wrote:
    >>
    >>> Can you do the following in Ada:
    >>>
    >>> 1. Write *one* bubble-sort function that will work on different
    >>> types given an appropriate comparison function

    >>
    >> Shure you can. Ada invented templates long bevore C++ was even though of.

    >
    > Factoid: Alex Stepanov started off his research that led to the STL in
    > Ada.


    I am not quite shure what you want to say. As far as I know generics had
    been part of Ada 83. But of course without some STL.

    >> Ada templates are far more powerfull then C++.

    >
    > Why do you say that? I haven't used Ada terribly much, but from what I
    > remember, I don't think Ada generics are Turing-complete, which C++
    > templates are.


    Well I have used C++ for 10 years and Ada for just 1 year - I can express my
    will better with Ada generics then with C++ templates.

    With Regards


    Martin
    --
    mailto://
    http://www.ada.krischik.com
     
    Martin Krischik, Feb 8, 2004
    #15
  16. On Sun, 08 Feb 2004 19:02:02 +0100, Martin Krischik wrote:

    > Josh Sebastian wrote:
    >
    >> On Sun, 08 Feb 2004 14:05:53 +0100, Martin Krischik wrote:
    >>
    >> Factoid: Alex Stepanov started off his research that led to the STL in
    >> Ada.

    >
    > I am not quite shure what you want to say.


    I was saying that the STL started off in Ada before it was moved to (and
    completed in) C++. I wasn't disagreeing with you (yet :).

    >>> Ada templates are far more powerfull then C++.

    >>
    >> Why do you say that? I haven't used Ada terribly much, but from what I
    >> remember, I don't think Ada generics are Turing-complete, which C++
    >> templates are.

    >
    > Well I have used C++ for 10 years and Ada for just 1 year - I can express my
    > will better with Ada generics then with C++ templates.


    Maybe you just weren't very good at C++ templates. I don't mean to be
    insulting, but personal preferences do play a huge roll here. Unless
    someone can prove Ada's generics are Turing-complete, though (a quick
    google doesn't turn up anything), I'd say that we'll have to call C++
    templates more powerful.

    Josh
     
    Josh Sebastian, Feb 8, 2004
    #16
  17. Re: No call for Ada (was Re: Announcing new scripting/prototypinglanguage)

    Josh Sebastian and Martin Krischik are continuing their silly language
    advocacy.
    Perhaps comp.lang.ada cares about the preference of one for Ada;
    perhaps comp.lang.c++. Who knows what the people in comp.lang.java care
    about? I know for damn sure that comp.lang.c is not the place for your
    silly discussion of Ada vs. C++.
    I have set follow-ups to comp.lang.ada and comp.lang.c++. Even that might
    be too much. In any event, take comp.lang.c off any future exchanges you
    idiots have. Even better: take it to e-mail.



    --
    Martin Ambuhl
     
    Martin Ambuhl, Feb 8, 2004
    #17
  18. Ludovic Brenta

    MSG Guest

    Martin Krischik <> wrote in message news:<>...

    > Others did that allready. Besides, you would need an installed Ada compiler
    > to verify anyway.


    time apt-get install gnat
    => 15 seconds

    > >
    > > Can you do the following in Ada:
    > >
    > > 1. Write *one* bubble-sort function that will work on different
    > > types given an appropriate comparison function

    >
    > Shure you can. Ada invented templates long bevore C++ was even though of.
    > Ada templates are far more powerfull then C++.


    Example?

    > > 2. If B is a subtype of A, can you pass it to any function that
    > > takes A as an argument? (covariance)

    >
    > subtype as in object orientation:
    >
    > type Parent is tagged null record;
    > type Child is new Parent with null record;


    "null record" ? How about non-null ones? Is a 3D point (x, y, z) a
    subtype of a 2D one (x, y) ?

    BTW, does Ada have discriminated unions? (if you don't know what they
    are, probably none of the language you used had them)

    Also, is it possible to corrupt memory in Ada?
    Is it possible to leak memory in Ada?

    > or subtype as in simple types:
    >
    > type Day_of_Month is range 1 .. 31;
    > subtype Day_of_Febuary is Day_of_Month range 1 .. 29;


    That's neat.

    > > BTW, the esteemed Mr. E. Robert Tisdale (ER for short) isn't
    > > letting on about why Ada isn't used much at NASA any more.

    >
    > He also won't tell you why Spirit died.


    It's not dead, it's sleeping!

    Cheers,
    MSG
     
    MSG, Feb 8, 2004
    #18
  19. Ludovic Brenta

    James Rogers Guest

    Given the quite reasonable objections presented by some in the
    cross-posted news-groups I would like to carry on this conversation
    with you via email. My return email is valid.

    Jim Rogers
     
    James Rogers, Feb 9, 2004
    #19
  20. (MSG) writes:

    > Martin Krischik <> wrote:
    >
    > > Others did that allready. Besides, you would need an installed Ada compiler
    > > to verify anyway.

    >
    > time apt-get install gnat
    > => 15 seconds


    Thanks, I made that package :)

    > > >
    > > > Can you do the following in Ada:
    > > >
    > > > 1. Write *one* bubble-sort function that will work on different
    > > > types given an appropriate comparison function

    > >
    > > Shure you can. Ada invented templates long bevore C++ was even though of.
    > > Ada templates are far more powerfull then C++.

    >
    > Example?


    I gave one earlier on c.l.ada. I did not cross-post it to the other
    newsgroups.

    Ada templates are superior to C++ templates in several respects. For
    one thing, you can pass procedures and functions as generic
    parameters, and the generic formal parameters specify the signature
    for them. Another thing is that the generic formal parameters can
    specify several kinds of restrictions to types that are acceptable.

    > > > 2. If B is a subtype of A, can you pass it to any function that
    > > > takes A as an argument? (covariance)

    > >
    > > subtype as in object orientation:
    > >
    > > type Parent is tagged null record;
    > > type Child is new Parent with null record;

    >
    > "null record" ? How about non-null ones? Is a 3D point (x, y, z) a
    > subtype of a 2D one (x, y) ?


    type Point_2D is tagged record
    X, Y : Float;
    end record;

    type Point_3D is new Point_2D with record
    Z : Float;
    end record;

    > BTW, does Ada have discriminated unions? (if you don't know what they
    > are, probably none of the language you used had them)


    Yes, they are called variant records.

    > Also, is it possible to corrupt memory in Ada?


    Yes, if you try hard enough and use Unchecked_Conversion and
    System.Address instead of the more usual stuff. Very hard in
    practice. I once tried to do a buffer overflow in Ada, and managed
    it, but the code to achieve this is rather ugly. Basically, you have
    to go the extra mile to corrupt memory in Ada.

    > Is it possible to leak memory in Ada?


    Yes, just like in C. However, since Ada programmers do much less
    dynamic memory allocation, this happens much less often than it does
    in C. Note that there also exists a garbage collector in Ada, as part
    of AdaCL.

    > > or subtype as in simple types:
    > >
    > > type Day_of_Month is range 1 .. 31;
    > > subtype Day_of_Febuary is Day_of_Month range 1 .. 29;

    >
    > That's neat.


    If this is neat then dig this:

    for J in Day_Of_Month loop
    exit when Month = February and then J >= Day_Of_February'Last;
    Put_Line (Day_Of_Month'Image (J));
    end loop;

    And think about the implications of these ranges on subprograms that
    accept only a small set of integer constants as a parameter:

    type Assessment is (Yes, No, Maybe, Maybe_Not);

    procedure P (A : Assessment);

    which is not possible in C:

    typedef enum { YES, NO, MAYBE, MAYBE_NOT } assessment_t;

    void P (assessment_t A) { }

    int main () {
    P (42); // no compiler check!
    return 0;
    }

    I just tried the above with gcc -Wall and got no warning. This means
    that only a human carefully reviewing this program will see the
    mistake (you may also try lint, but this is a tool external to the
    language and based on heuristics, not language rules). By contrast,
    the Ada compiler catches the mistake automatically in seconds and
    leaves you with the confidence that 100% of your code has been
    screened for such stupid mistakes.

    --
    Ludovic Brenta.
     
    Ludovic Brenta, Feb 9, 2004
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Joona I Palaste

    Re: Ada performance (was No call for Ada )

    Joona I Palaste, Feb 15, 2004, in forum: Java
    Replies:
    0
    Views:
    467
    Joona I Palaste
    Feb 15, 2004
  2. Dave Allison
    Replies:
    37
    Views:
    822
    Warren W. Gay VE3WWG
    Mar 4, 2004
  3. Dave Allison

    Announcing new scripting/prototyping language

    Dave Allison, Feb 5, 2004, in forum: C Programming
    Replies:
    35
    Views:
    906
    Warren W. Gay VE3WWG
    Mar 4, 2004
  4. Ludovic Brenta
    Replies:
    77
    Views:
    1,480
    Hyman Rosen
    Feb 26, 2004
  5. DaveInSidney
    Replies:
    0
    Views:
    460
    DaveInSidney
    May 9, 2005
Loading...

Share This Page