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.7 required=5.0 tests=BAYES_00,INVALID_DATE, MSGID_SHORT,REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!software.org!blakemor From: blakemor@software.org (Alex Blakemore) Newsgroups: comp.lang.ada Subject: Re: if UNIX then USE_C ?? (was: Reasons for drop) Message-ID: <598@software.software.org> Date: 28 Feb 90 01:19:42 GMT References: <27187@cup.portal.com> <18175@megaron.cs.arizona.edu> <5563@crdgw1.crd.ge.com> <184@trwacs.UUCP> Sender: news@software.org Reply-To: blakemor@software.org (Alex Blakemore) Organization: Software Productivity Consortium, Herndon, Virginia List-Id: In article <184@trwacs.UUCP> epstein@trwacs.UUCP (Jeremy Epstein) writes: > ... look at how Ada overloads symbols. For > example, parentheses are used for parameters as well as subscripts > (that's something that totally confuses me as an old-time C programmer). This is a strength of Ada not an inconsistency. This way you can change between using an array and a function to provide some info - for example the text sin(x) refers to some real value. sin could be a constant array or a function (a time/space tradeoff) - only the providing package need know. You can change your mind in one place and need only recompile. Provided you avoid named parameter association in this case. This is consistent with some formal proof methods (like Tony Hoare's) which treat array references as function calls. Logically they have the same effect. Mathematically a function is essentially a table anyway. Of course, there is a difference when you assign to an array element. The same syntactic overloading lets you reference a constant, variable or parameterless function using the exact same syntax. One safe way to have read only global variables is to define a visible (spec level) function that returns the current value, but hide the variable inside the package body - so only trusted operations can update it. Again, why should the code making the reference need to know how it is resolved- that is between the owning package and the compiler? C has some elegance but why should the programmer have to remember when to use [] or () ? just to make the compiler easier to write ? -- ------------------------------------------------------------------------- Alex Blakemore blakemore@software.org (703) 742-7125 Software Productivity Consortium 2214 Rock Hill Road Herndon, VA 22070 ------------------------ Eschew Obfuscation !!! -----------------------