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=unavailable autolearn_force=no version=3.4.4 Path: border2.nntp.dca1.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Jeffrey Carter Newsgroups: comp.lang.ada Subject: Re: Generics crash course Date: Thu, 15 Jan 2015 23:27:19 -0700 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: <121014ba-309c-45a0-950a-20b5b15210c5@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Injection-Date: Fri, 16 Jan 2015 06:26:52 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="8b798b1cbad0bd6c9b93de345575f48d"; logging-data="30135"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19RPYK466CqfBEB49JEpuDPS2DGKp/pCvc=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 In-Reply-To: Cancel-Lock: sha1:CrjPYyjLN/gt1Aahb8OzKA8G0rU= Xref: number.nntp.giganews.com comp.lang.ada:191898 Date: 2015-01-15T23:27:19-07:00 List-Id: On 01/15/2015 10:43 PM, Niklas Holsti wrote: > > type Element_Type is private; > > says that Search depends on a type with the formal name Element_Type, > but that Search assumes very little about the nature of the type, because it is > defined as "private". The actual type could be an integer, a float, a record, an > array (of fixed size), ... It says the actual must have assignment and "=" defined. > type Index_Type is range <>; > > says that Search also depends on a type with the formal name Index_Type, and > that Search assumes that this type is a "discrete" type such as an integer type > or an enumeration type. This says the actual must be a signed integer type. A generic formal type that can be any discrete type is "(<>)". > By the way, all the "return" statements in the example (lines 68, 142, 155) are > superfluous, because a subprogram returns when its "end" is reached. A procedure returns when its "end" is reached. A function, which is also a subprogram, raises Program_Error if it reaches its "end". -- Jeff Carter "Mr. President, we must not allow a mine-shaft gap!" Dr. Strangelove 33