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,9a7e0c43216f4def X-Google-Attributes: gid103376,public From: Robert A Duff Subject: Re: "out" or "access" Date: 1998/10/29 Message-ID: #1/1 X-Deja-AN: 406135854 Sender: bobduff@world.std.com (Robert A Duff) References: <908956499.754394@dedale.pandemonium.fr> <70mo3h$gll$1@cf01.edf.fr> Organization: The World Public Access UNIX, Brookline, MA Newsgroups: comp.lang.ada Date: 1998-10-29T00:00:00+00:00 List-Id: "Pascal Obry" writes: > PS : The Win32Ada binding is full of access parameters that are just wrong ! That's because (1) the author didn't know about this rule (that access parameters don't allow null), and (2) the compiler he was using didn't check this rule (back then). The access-parameter feature was invented specifically to solve the following problem: You want to pass a tagged thing as a parameter to a dispatching operation, and of course have it dispatch as usual, but you want to store a pointer to that thing in a global data structure. Therefore, access parameters have these features: (1) if the procedure is in the right place, it's a dispatching op, (2) no null's are allowed, because of course you can't dispatch unless you have a tag, and so the pointer has to point to some tagged object, rather than be null, and (3) you can pass pointers to more-nested things into less-nested procedures (with some run-time accessibility checks). You also get implicit conversion of pointer-to-class-wide types (in the safe direction). In retrospect, I think it would have been better to separate the individual features more orthogonally. Eg, I sometimes want to declare a record component that can never be null -- Ada has a way to declare never-null things, but only if they're formal parameters. Another eg, if "type T2 is new T1...", then T2 implicitly converts to T1'Class, but access-to-T2 does not implicitly convert to access-to-T1'Class, except in the case of access parameters -- I would like a more general feature, to avoid making "safe" conversions explicit. Given the specific problem access params were intended to solve, "access constant" made little sense. But in restrospect, I think we should have allowed it. It was only later that we noticed access params might be useful in interface-to-C. Of course that's only true for C functions that don't expect a NULL. It also requires the compiler to omit the extra dope needed to do the run-time accessibility checks -- of course the C compiler can't deal with that extra dope. - Bob -- Change robert to bob to get my real email address. Sorry.