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,ca21162c929cc36f X-Google-Attributes: gid103376,public From: kilgallen@eisner.decus.org (Larry Kilgallen) Subject: Better MacOS Handles through Ada (was: Implementing Pointers to Pointe Date: 1996/09/13 Message-ID: <1996Sep13.080055.1@eisner>#1/1 X-Deja-AN: 180359942 x-nntp-posting-host: eisner.decus.org references: <511sp9$ogs@newsbf02.news.aol.com> <3235E2C3.636F@itg-sepg.logicon.com> <1996Sep12.144206@nova.wright.edu> x-nntp-posting-user: KILGALLEN x-trace: 842616100/8341 organization: LJK Software newsgroups: comp.lang.ada Date: 1996-09-13T00:00:00+00:00 List-Id: In article <1996Sep12.144206@nova.wright.edu>, jmatthews@nova.wright.edu (Dr. John B. Matthews) writes: > MacOS on PPC uses the same interface for memory management as 68K, > although the implementation has changed considerably:-) I recently > had the pleasure of working on MacOS bindings for GNAT on MacOS > with MachTen. The bindings rely extensively on declarations such as > > type ObjectRec is > record > ... > end record; > type ObjectPtr is access ObjectRec; > type ObjectHdl is access ObjectPtr; > > The ObjectHdl.all.all syntax looks strange at first, but MacOS > programmers at a recent trade show seemed to have no trouble > following the sample code we showed them. Although I was at what was probably the trade show to which you allude, I did not discuss that aspect of Ada bindings with you. I would maintain, however, that that construct is quite obvious to anyone who has had to struggle with MacOS programming in any other language. I think this is an opportunity to prove the superiority of Ada, by hiding those details so that future generations of MacOS programmers do not have to deal with ugly constructs like ObjectHdl.all.all the way their brethren do in less powerful languages. I believe those intricacies should be hidden in the private part of type declarations for the various entities which might be in heap. Some "special" (in the church-lady sense) child declarations might be available for direct access, but most occasions for locking handles should be avoided and the rest should be mediated by the handle package. I believe what I am looking for is a generic package, so that specific instances can be declared for the various types one might put in heap. I do not mean to suggest that what has been done to date is improper -- certainly allowing MacOS programmers to emulate their activities in previous languages is a good start, but Ada has the capability to provide something better, hiding some really arcane OS behaviour from programmers who have more interest in correctness and productivity than winning a MacOS trivia contest. Larry Kilgallen