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,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,29fe9a340e0d180d X-Google-Attributes: gid103376,public From: hbaker@netcom.com (Henry Baker) Subject: Re: Depending on passing mechanism Date: 1997/10/15 Message-ID: #1/1 X-Deja-AN: 280785269 Sender: hbaker@netcom3.netcom.com References: <622b4t$nhe$1@gonzo.sun3.iaf.nl> Organization: nil Newsgroups: comp.lang.ada Date: 1997-10-15T00:00:00+00:00 List-Id: In article <622b4t$nhe$1@gonzo.sun3.iaf.nl>, Geert Bosch wrote: > In general this cannot be detected at compile time. Solving this > aliasing problem in the language (for example using reference > counting) will result in significant extra complexity and distributed > overhead. This added complexity and overhead would be two strong > reasons not to use the "improved" language for embedded systems > like those in the Boeing 777 you mentioned. > > Do you have a proposal to remove the non-determinism without affecting > performance and flexibility too much? I think many readers in this > group might be interested in such ideas, at least I am. > > Regards, > Geert Yes. There are 3 solutions, any of which is better than the current Ada 'non deterministic' solution. 1. _Always_ pass by reference. This can be forced in C/C++ by certain coding styles. Any aliasing is assumed to be programmer-intended, and has a relatively simple programming model. (You may have to liberally sprinkle 'volatile'-type thingy's around as well.) There is a certain cost, but on modern microprocessors the cost is not exorbitant, and certainly less than the cost of a 777. 2. _Always_ pass by value. This is really possible only in a 100% functional language like Haskell. 3. Add a new concept to your language: 'linear'/'unique' types. These objects are guaranteed to be singly referenced because this is enforced by the type system. Poof! No aliasing! This concept was pioneered by NIL/Hermes, and has recently been incorporated into some logical (prolog-like) languages and some functional languages ('Clean' from KU Leaven). There is a large and growing body of mathematics called 'linear logic' that puts linear types on a firm theoretical foundation. The NIL/Hermes people tried to get people in the Ada community to pay attention, but they were completely ignored, and Ada95 suffered for it.