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,2efc07c562a92932 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!not-for-mail From: "Martin Dowie" Newsgroups: comp.lang.ada Subject: Re: Ada & Postgresql Date: Mon, 6 Sep 2004 13:54:04 +0100 Organization: BAE SYSTEMS Message-ID: <413c5be5$1_1@baen1673807.greenlnk.net> References: <2prmojFo9eo1U1@uni-berlin.de> <2q2m4sFqobhgU1@uni-berlin.de> <2q2nvhFq4qqdU1@uni-berlin.de> <2q2r9tFqihj7U1@uni-berlin.de> <2q30d9Fr1gbmU1@uni-berlin.de><413C4FFE.1010105@netcabo.pt> X-Trace: news.uni-berlin.de Sw/caKJ1XIuPPTuT9kCSVweax7e3dCnj+fkL9Va7/yZcR7TP52 X-Orig-Path: baen1673807.greenlnk.net!baen1673807!not-for-mail X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700 X-Original-NNTP-Posting-Host: baen1673807.greenlnk.net Xref: g2news1.google.com comp.lang.ada:3374 Date: 2004-09-06T13:54:04+01:00 List-Id: Marius Amado Alves wrote: >> ...I can't pinpoint now what annoying Ada 95 feature >> I was escaping back in 2001 when I wrote this package and its >> applications. Never mind. Just write Pgsql_Controlled. > > OK, I just took the time to write this. While I'm at it, I'll control > also Db_Type, to call Close on finalization. Oops, no, Ada 95 does not > let me do that, it makes > > function Execute (Db: Db_Type; Command: String) return > Result_Type; > > illegal, because an "operation can be dispatching in only one type." > > This is one of many examples of what I call "Ada getting in the way." But isn't the solution to this to just wrap one of them in a 'plain' record, e.g. package Foo is type Command_Type is private; type Result_Type is private; -- whatever function Bar (CT : Command_Type) return Result_Type; private type Command_Type is new Ada.Controlled... procedure Finalize (C : in out Command_Type); type Inner_Result_Type is new Ada.Controlled... procedure Finalize (IR : in out Inner_Result_Type); type Result_Type is record IR : Inner_Result_Type; end record; end Foo; Cheers -- Martin