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,18aea7ce90e03321 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-07-12 10:24:27 PST Newsgroups: comp.lang.ada Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed1.cidera.com!news-reader.ntrnet.net!uunet!ash.uu.net!xyzzy!nntp From: Jeffrey Carter Subject: Re: Direct_IO problem -- generic package problem X-Nntp-Posting-Host: e246420.msc.az.boeing.com Content-Type: text/plain; charset=us-ascii Message-ID: <3B4DD722.EB6F3AB7@boeing.com> Sender: nntp@news.boeing.com (Boeing NNTP News Access) Content-Transfer-Encoding: 7bit Organization: The Boeing Company X-Accept-Language: en References: <9ijobe$qb4$1@mercur.foa.se> Mime-Version: 1.0 Date: Thu, 12 Jul 2001 16:58:10 GMT X-Mailer: Mozilla 4.5 [en]C-CCK-MCD Boeing Kit (WinNT; U) Xref: archiver1.google.com comp.lang.ada:9881 Date: 2001-07-12T16:58:10+00:00 List-Id: In Ada 83, you could say generic -- Example type T is limited private; package Example is ... end Example; and then, before supplying a body for Example, write something like package P is new Example (T => String); Then you could supply a body for example that creates a variable of type T: package body Example is V : T; ... end Example; This is the same as writing V : String; which is clearly illegal. This would be caught eventually, but was a "gotcha" that was removed in Ada 95. Now the generic formal type as given means that it must be possible to declare a variable of the type (the type must be "definite"). The new generic formal syntax type T (<>) is [limited] private; allows the generic to be instantiated with an indefinite type, but means the generic cannot declare any uninitialized objects of the type. Ada.Direct_IO declares the generic formal type type Element_Type is private; so the type used to instantiate Direct_IO must be definite, while your type Matrix is indefinite. You have a few possibilities Use a subtype in place of Small_Nat with a small enough range that you can provide defaults for all discriminants without encountering Storage_Error if you declare an unconstrained variable. Instantiate Direct_IO with constrained subtypes of Matrix for the types of interest. Good luck. -- Jeffrey Carter