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-Thread: 103376,8591be732d0fce98 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "(see below)" Newsgroups: comp.lang.ada Subject: Re: Ada OOP alternatives? Date: Thu, 17 Jul 2008 12:07:55 +0100 Message-ID: References: <462e0cf4-1d53-4918-b30b-dd3d8df90f1b@p25g2000hsf.googlegroups.com> <487d9636$0$6543$9b4e6d93@newsspool3.arcor-online.net> <6e5uq2F5g7n6U2@mid.individual.net> Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Trace: individual.net L7Y+tXLnaIYK4pqSd+1BdQALPKXrz6ultyp1ovtYULb1QTg1a9 Cancel-Lock: sha1:R3vNrmYXnfdv1zwKOmMO/WGC53I= User-Agent: Microsoft-Entourage/12.11.0.080522 Thread-Topic: Ada OOP alternatives? Thread-Index: Acjn/VzQtgMRPfYHUEuJBhIoG21lCQ== Xref: g2news2.google.com comp.lang.ada:6919 Date: 2008-07-17T12:07:55+01:00 List-Id: On 17/07/2008 02:36, in article wccy741fg0z.fsf@shell01.TheWorld.com, "Robert A Duff" wrote: > "(see below)" writes: > >> On 17/07/2008 01:05, in article wcc3am9gytt.fsf@shell01.TheWorld.com, >> "Robert A Duff" wrote: >>> I'd still rather eliminate private parts altogether. >> >> How would you do that while allowing ADT clients to access objects directly >> (i.e. not via a pointer a la Java)? > > I'd have the compiler take a peek at the body when compiling the client. > After all, that's what Ada compilers already do for pragma Inline. Good point. That does induce a bit more compile-time overhead, though, as all clients would have to be recompiled on every update to the body. > And I think incremental compilation can be a big win. > In fast-compile mode, I might tolerate the "via pointer" way. > It doesn't need to be a pointer into the heap, as in Java. > > We're just talking about the size of the type, really -- you say > "access objects", but clients can't access the record components > of a private type -- all they can do is declare objects and > pass them around. And copy them. Yes, but to do that well, they need to know at least the size of the representation. > Java, like many languages, doesn't even _have_ separate specs. > (And it _still_ insists on pointers for almost everything!) I loathe the Java type system's incoherence. > So it's clearly feasible to have information in bodies used > when compiling clients. Certainly. To what extent do you think that the (optical) visibility of the representation in the Ada private part offsets a need to give the client's programmer a more formal statement of the semantics of the ADT? -- Bill Findlay chez blueyonder.co.uk