From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: "end of declaration"
Date: Thu, 11 Feb 2021 00:43:20 +0200 [thread overview]
Message-ID: <i8j5s8FfohvU1@mid.individual.net> (raw)
In-Reply-To: <6c37665d-e615-48e5-be6d-3c862d18917bn@googlegroups.com>
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.
next prev parent reply other threads:[~2021-02-10 22:43 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-10 18:39 "end of declaration" Mehdi Saada
2021-02-10 19:06 ` AdaMagica
2021-02-10 19:21 ` Egil H H
2021-02-10 19:31 ` Mehdi Saada
2021-02-10 21:08 ` Shark8
2021-02-10 22:43 ` Niklas Holsti [this message]
2021-02-10 20:59 ` Shark8
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox