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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ad988eb0a9545c86 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-04-13 16:02:08 PST Newsgroups: comp.lang.ada Path: supernews.google.com!sn-xit-03!supernews.com!freenix!fr.clara.net!heighliner.fr.clara.net!RENT.THIS.SPACE.FOR.ADVERTISING!newsfeed.online.be!zur.uu.net!ash.uu.net!world!bobduff From: Robert A Duff Subject: Re: Problem trying to implement generics. Sender: bobduff@world.std.com (Robert A Duff) Message-ID: Date: Fri, 13 Apr 2001 23:01:02 GMT References: <9b46dr$cd8$1@taliesin.netcom.net.uk> <9b6jtu$4is$2@taliesin.netcom.net.uk> <9b6m27$68e$1@taliesin.netcom.net.uk> <0JBB6.10484$FD1.1197250@news6-win.server.ntlworld.com> <9b7tce$laf$2@taliesin.netcom.net.uk> Organization: The World Public Access UNIX, Brookline, MA X-Newsreader: Gnus v5.3/Emacs 19.34 Xref: supernews.google.com comp.lang.ada:6877 Date: 2001-04-13T23:01:02+00:00 List-Id: "Ayende Rahien" writes: > BTW, is there any reason why I can't use out parameter with a function? Because it's not allowed. ;-) Hmm, are we going have this argument again? Oh well, it's kind of fun, in a time-wasting sort of way. Here goes: If I ran the circus, functions would be allowed to have 'out' and 'in out' parameters. - Bob P.S. One workaround is to use access parameters. Another workaround is to declare a limited type, with a component that always points to itself: type T is tagged limited record Self_Reference: T_Ptr := T'Unchecked_Access; ... end record; If you pass this thing as an 'in' parameter to a function, the function can modify it by following the Self_Reference pointer. This works because no constant objects of type T can exist. It seems a lot like "cheating", doesn't it?