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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,5117b1b6391a0e06 X-Google-Attributes: gid103376,public Path: g2news1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Dmitry A. Kazakov Newsgroups: comp.lang.ada Subject: Re: A simple ADA puzzle (I haven't the answer) Date: Thu, 17 Jun 2004 16:16:32 +0200 Message-ID: <7o83d0hf6sqgng2980e1tg7iu864m5m50u@4ax.com> References: <1087410710.477506@master.nyc.kbcfp.com> <1087474761.60413@master.nyc.kbcfp.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de KLGX2ufVbJFomQVCL9Jb5QPOlPPWD1wQjnt5A9qhXV+0aWcCs= X-Newsreader: Forte Agent 1.8/32.548 Xref: g2news1.google.com comp.lang.ada:1620 Date: 2004-06-17T16:16:32+02:00 List-Id: On Thu, 17 Jun 2004 08:19:21 -0400, Hyman Rosen wrote: >Dmitry A. Kazakov wrote: >> If a programmer does not understand what are arrays, types and >> constraints, then probably he/she should look for other job, probably >> as a dish-washer? > >But this programmer does understand what arrays and types are, >just not how they manifest in Ada. And constrained types are >unique to Ada, or at least they are not present in the popular >languages of the day. But constraining is so general concept that requires no explanations, IMO. Then I would argue that the following in C++ is an example of contraining: class Base { public : Base (int Constrain) { ... } }; class Constrained { public : Constrained () : A (25) { ... } }; >Knowing what an array is has nothing to >do with knowing that in Ada they can be passed by value, Again, passing by value vs. by reference is a general concept. It is not clear why somebody should think of array as of something being passed in some definite way. Why should he/she care of parameter passing? Knuth's saying about evils of premature optimization should be carved in everybody's mind. >or that >you can declare an array object which gets its bounds from an >initializer. What about C++ which has contructors with parameters? I would rather expect people perplexed by Ada's lack of true constructors with parameters. But that is another story. >Knowing what a type is does not tell you that in >Ada a polymorphic type can't be declared in the same places that >other types can. Not worse than in C++, where you cannot: void foo () { class Local {...}; Local Thing; ... }; Everybody agree that silly limitations are annoying, even if they have more or less firm rationale. >And that bit of code with constraints that eats >all of memory looks completely innocent. > >How is an Ada newcomer >to know that the default discriminant doesn't apply when an object >of that type is created? Here I agree, I think that was a mistake to tie these things together. >Since most programmers do not know Ada, if they are to be taught >the language then these places where Ada is extremely different >from the languages they do know must be carefully described, and >done so in terms of the concepts they already know. First the difference is not that big. Second they should think in terms of more generic concepts, which all programming languages share. If somebody thinks of integers as being 16-bits long because his first C compiler was for PDP-11, then dirty dishes are waiting for him. >Acting condescendingly towards people who are not learned in the >nuances of what is at best a niche language is not going to win >any converts. I do not think that Ada is so far away from other languages. I wished it were true, but it isn't. -- Regards, Dmitry Kazakov www.dmitry-kazakov.de