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-Thread: 103376,6689542a60dbcc55 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,UTF8 Path: g2news1.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!usenet-fr.net!gegeweb.org!aioe.org!not-for-mail From: =?utf-8?Q?Yannick_Duch=C3=AAne_=28Hibou57?= =?utf-8?Q?=29?= Newsgroups: comp.lang.ada Subject: Re: Discriminated records are not the most efficient, but ... Date: Mon, 23 Aug 2010 00:07:45 +0200 Organization: Ada At Home Message-ID: References: <874oemcr37.fsf@mid.deneb.enyo.de> NNTP-Posting-Host: qaSBlvV+1zCl6PWY+jYb4w.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Content-Transfer-Encoding: Quoted-Printable X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.8.2 User-Agent: Opera Mail/10.61 (Win32) Xref: g2news1.google.com comp.lang.ada:13637 Date: 2010-08-23T00:07:45+02:00 List-Id: Le Sun, 22 Aug 2010 22:47:24 +0200, Florian Weimer a = = =C3=A9crit: > But doesn't that mean that the package you want to pass has to be an > instance of a generic package? I haven't seen that programming style > much. Yes, as said in 12.7(2) http://www.adaic.org/standards/05rm/html/RM-12-7.html So let say it can do it with restrictions (while that's easy to turn any= = package into a generic package, without any formal parameters... but you= = will have to do the same for all child packages). > (Ada hasn't got another way to express module types, so this shouldn't= > come as a surprise.) By the way, a generic package does not define a type, so there is no = module type (if I understand you correctly). In Ada they are all = compilation units. But they defines an interface, which from an abstract= = point of view make it something like a typed object, for a package = instance, or something may be a bit like a type for a none-instantiated = = generic package (i.e. the package definition). But you will not be able = to = derive a package from another package (there is nothing like =E2=80=9Cty= pe package = Z is new Y with ... end Z;=E2=80=9D) ; so this would be rather limited v= iew of a = type. However, you have Tagged types and Records which can be derived and have= = primitives and a state just like packages does, but you will not be able= = to define a type inside of a tagged or record definition. The package in Ada, is really an architectural and organizational elemen= t = (which includes reusability, via generic packages) and does not concrete= ly = intersect with the type system (except from some abstract point of view)= . The only thing I know which would the more look like a package and a typ= e = in the mean time, is task or protected types. This is more really a type= = (and can indeed be defined like type, while this is not required), as it= = can be used to recursively define another type (a task type may be a = component of a record, or component of an array as examples) while a = package cannot (there is nothing like defining a record with a package = type component or an array of packages). I am not sure if a task is considered a compilation unit or not (I have = = check the RM, it says No... but I am still not sure, I feel it should be= ) Thanks for the interesting point you raised. (hope I did not said any erroneous things in this reply)