[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [objc-improvements] Warnings when compiling GNUStep
From: |
Riccardo Mottola |
Subject: |
Re: [objc-improvements] Warnings when compiling GNUStep |
Date: |
Thu, 04 Sep 2003 18:32:50 +0200 |
User-agent: |
Microsoft-Outlook-Express-Macintosh-Edition/5.02.2022 |
on 9/4/03 3:05 AM, Ziemowit Laski at zlaski@apple.com wrote:
>>> Covariant return types (unlike covariant arguments :-) ) are valid in
>>> an OO-theoretic sense,
>>
>> Why not arguments? As far as I can tell, this applies to arguments as
>> well, but the "other way". Ie. for return types a subclass can specify
>> a
>> more specific type, while for arguments, a subclass can specify a more
>> generic type.
>
> ...which would make them contravariant, not covariant. :-)
yes, this triggers memories of OO lessons in Software Engeneering with prof.
Ghezzi.
I say my word as a prophane in this discussion. Shouldn't variances be
thought so that you could always use the more generic class instead of the
child? So if you put a broader return type in a subclass this could cause
trouble..
suppose you have (in a sort of pseudo-language)
if you have that human_being is son of living_thing, that male and female
are sons of human_beings, and that pets are sons of living_things too.
<human_being> Relation1 <human_being>
I could specify it to:
<female> MarriedTo <male>
or
<male> MarriedTo <female>
and you could still check against Rel1 for everything to work
but if you broaden the type of return you can run into trouble:
<living_thing> isPetOf <human_being>
you have broadened the sub-class and you cold not check types successfully
if you use the broad class,
that is my 2 xents and please excuse my untechincal speaking, but I have
half forgotten those terms as at the moment I have other problems in mind ;)
-riccardo
- [objc-improvements] Warnings when compiling GNUStep, Ziemowit Laski, 2003/09/02
- Re: [objc-improvements] Warnings when compiling GNUStep, Ziemowit Laski, 2003/09/03
- Re: [objc-improvements] Warnings when compiling GNUStep, Alexander Malmberg, 2003/09/03
- Re: [objc-improvements] Warnings when compiling GNUStep, Ziemowit Laski, 2003/09/03
- Re: [objc-improvements] Warnings when compiling GNUStep,
Riccardo Mottola <=
- Re: [objc-improvements] Warnings when compiling GNUStep, Alexander Malmberg, 2003/09/04
- Re: [objc-improvements] Warnings when compiling GNUStep, Ziemowit Laski, 2003/09/04
- Re: [objc-improvements] Warnings when compiling GNUStep, Alexander Malmberg, 2003/09/04
- Re: [objc-improvements] Warnings when compiling GNUStep, Ziemowit Laski, 2003/09/04
- Re: [objc-improvements] Warnings when compiling GNUStep, Nicola Pero, 2003/09/05