From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: Trouble with "operation can be dispatching in only one type"
Date: Wed, 13 Aug 2014 23:01:42 +0300
Date: 2014-08-13T23:01:42+03:00 [thread overview]
Message-ID: <c51uh6Frnc9U1@mid.individual.net> (raw)
In-Reply-To: <lsgdvt$g4h$1@speranza.aioe.org>
On 14-08-13 22:23 , Victor Porton wrote:
> I defined two tagged types T1 and T2 in some package.
>
> I need a function in the same package:
>
> not overriding function F (Stack: T1) return T2;
>
> The compiler complaints:
>
> operation can be dispatching in only one type
>
> My current workaround is to define it instead as:
>
> not overriding function F (Stack: T1'Class) return T2;
>
> But this is a hack. Can I define this function in the right way? (I want it
> to be dispatching only in T1, not T2.)
To be dispatching in T1, but not in T2, it should be
function F (Stack : T1) return T2'Class;
If the use of 'Class to prevent dispatching is a problem for you,
another way is to put the two type declarations in different packages.
A function F can be dispatching only in the type declared in the same
package as F. For example, if T2 is declared in a different package than
T1 (including a package nested within the package that declares T1) then
you can declare function F (Stack : T1) return Some_Pkg.T2 and it will
dispatch only in T1 (assuming that T1 and F are declared in the same
package declaration).
--
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
. @ .
prev parent reply other threads:[~2014-08-13 20:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-13 19:23 Trouble with "operation can be dispatching in only one type" Victor Porton
2014-08-13 19:44 ` Victor Porton
2014-08-13 20:01 ` Niklas Holsti [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox