From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Path: eternal-september.org!reader02.eternal-september.org!news.szaf.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: "end of declaration" Date: Thu, 11 Feb 2021 00:43:20 +0200 Organization: Tidorum Ltd Message-ID: References: <82631dc2-2903-4848-b662-eb149331623cn@googlegroups.com> <07236c74-1838-42bd-9d02-bde8cb308071n@googlegroups.com> <28d57bf5-eb21-4ec4-b44d-896edcc5cc52n@googlegroups.com> <6c37665d-e615-48e5-be6d-3c862d18917bn@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net LJztXolpIKq/8gFpkFyDJwgq6FaaHtEg9y4Wgr0HFFwdO5gfj1 Cancel-Lock: sha1:sr/tnxXWFD/Au6Wk/yG1RRegdVU= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 In-Reply-To: <6c37665d-e615-48e5-be6d-3c862d18917bn@googlegroups.com> Content-Language: en-US Xref: reader02.eternal-september.org comp.lang.ada:61340 List-Id: On 2021-02-10 23:08, Shark8 wrote: >> otherwise, operations for t_proba are redefined in the visible >> (and body) part so recursion will occur. > What? > No, "Type J is new K" gives you a completely new type. Yes, but J inherits all primitive operations of K. And you can type-convert between J and K with no loss of information. > To use a function that requires a K-value with a J-value you have to > explicitly convert; given "Steve : J" and "-"(Right: K) return K, you > would have to use -(K(Steve)) to call the unary-minus for K. If the "-" function is a primitive operation of K, there is an identical inherited operation for J. If the "-" with a K-parameter is not primitive for K, it is not inherited by J, and a J-value j must be converted to a K-value before that "-" is called: - K(j). You can override the inherited "-" with a new operation, specific to J. Within that operation, calling "-" on a J-value j would make it recursive. The K-operation can be called with - K(j) and that will not be a recursive call.