liberty-eiffel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Liberty-eiffel Digest, Vol 53, Issue 9


From: Eric Bezault
Subject: Re: Liberty-eiffel Digest, Vol 53, Issue 9
Date: Mon, 21 Feb 2022 00:44:12 +0100
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1

Just to be clear, I'm not trying to "sell" you the notation specified
in ECMA for non-conforming inheritance. I just tried to explained
what it is and what lead to this design, without any assumption about
whether this notation is good or bad. Anyway, ECMA only specifies
'inherit {NONE}' in the standard, but not 'inherit {SOME_OTHER_CLASS}'.

--
Eric Bezault
mailto:ericb@gobosoft.com
http://www.gobosoft.com


On 21/02/2022 0:34, Eric Bezault wrote:
On 21/02/2022 0:22, Paolo Redaelli wrote:
Il 21/02/22 00:10, Eric Bezault ha scritto:
On 20/02/2022 23:39, Paolo Redaelli wrote:
Wise words. I always wondered if "inherit {NONE}" is non conforming inheritance, what's the meaning of "inherit {ANY}" or inherit "{SOME_OTHER_CLASS}" ?

* inherit {NONE}: inheritance link (i.e. conformance) visible
  by no class. No client knows that the current class inherits
  from its parent, and therefore we cannot use this property
  when trying to figure out whether the type of the source of an
  assignment appearing in the client class conforms to the type
  of the target.

* inherit {ANY}: inheritance link visible by all classes.

* inherit {SOME_OTHER_CLASS}: inheritance link visible only
  by descendants of class SOME_OTHER_CLASS.


It's not very different from the notions 'feature {FOO}' or
'create {FOO}' where the feature or creation procedure is visible
only to descendants of class FOO, or to no class if FOO is NONE,
or to all classes if FOO is ANY.

That's interesting yet, but I can't find an use case....

For example...

class FOO feature salute do ... end

class HEIR inherit {FRIEND} FOO

class TRAITOR inherit {FOE} FOO

and somewhere else

class PERSON

feature manage(a_foo: FOO) a_foo.salute end

feature handle

     local h: HEIR; t: TRAITOR

     do

         manage(h)

         manage(t)

     end

Class PERSON does not know that HEIR and TRAITOR
inherit from FOO. So the code above in not valid.

But if you write:


class PERSON

feature manage(a_foo: FOO) a_foo.salute end

end

class FRIEND

inherit PERSON

feature handle

     local h: HEIR

     do
         manage(h)
     end
end

class FOE

inherit PERSON

feature handle

     local t: TRAITOR

     do
         manage(t)
     end
end


then the code is valid.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]