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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,af92cb4b0cc736af,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-10-31 04:07:35 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.wirehub.nl!bnewspeer00.bru.ops.eu.uu.net!auucp0.ams.ops.eu.uu.net!bnewsifeed01.bru.ops.eu.uu.net!bnewspost00.bru.ops.eu.uu.net!emea.uu.net!read.news.de.uu.net!not-for-mail Date: Thu, 31 Oct 2002 13:06:53 +0100 From: Ulrich Eckhardt Organization: Private at home User-Agent: Mozilla/5.0 (X11; U; Linux i686; en; Stable) Gecko/20020603 Beonex/0.8-stable X-Accept-Language: de, de-DE, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: problem with abstract types Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 1Cust63.tnt14.fft4.deu.da.uu.net X-Trace: 1036066053 read.news.de.uu.net 193 149.225.210.63 X-Complaints-To: abuse@de.uu.net Xref: archiver1.google.com comp.lang.ada:30251 Date: 2002-10-31T13:06:53+01:00 List-Id: Hi, i am starting my first project in ada (A complete rewrite of WHFC, see my Homepage). For this i want to write an OS independend way to store configuration informations (on windows in the registry and on unix in human readable config files). Therefore my idea was to created a package registry wich defines an abstract type registry and several abstract functions and (at this time) one real function . package registry is type registry is abstract tagged limited private; type registry_Access is access all registry'Class; procedure openRegistry(reg : in out registry; ..) is abstract; function getRegistry( .. ) return registry_Access [..] Also i have created a child package registry.unix, which implements the abstract functions for using on unix: package registry.unix is type file_registry is new registry with private; procedure openRegistry(reg : in out file_registry; ..); [..] Also i will create a package registry.win which does the same for windows. package registry.win is type win_registry is new registry with private; procedure openRegistry(reg : in out win_registry; ..); The function getRegistry of the main package should return and initialize now depending on the os a package registry.win or registry.unix, since for the use of this package it should not be visible on which platform it was compiled. function getRegistry (a : in sys_access; p_name : in Unbounded_String) return registry_Access is r : registry_Access; begin if compiled = SYS_UNIX then r := new file_registry(s_access => a); else r := new win_registry(); end if; return r; end getRegistry; So in a testprogramm i use : with registry; use registry; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; procedure main is reg : registry_Access; err : r_error; begin reg := getRegistry(CLASS_USER,To_Unbounded_String("registrytest")); openRegistry(reg'access,err); end main; But when compiling this code i get a main.adb:10:20: prefix of "access" attribute must be aliased Any hints what i am missing, or comments how such things are better done in ada? Uli -- Ulrich Eckhardt http://www.uli-eckhardt.de