ECMA select: redeclare or rename

8 Messages Forum Options Options
Permalink
federico_olivia
ECMA select: redeclare or rename
Reply Threaded More
Print post
Permalink
The ECMA standard say:
Validity: Repeated Inheritance Consistency constraint
 It is valid for a class D to have two or more versions of a feature f  
of a proper ancestor A if and only if it satisfies one of the following
conditions:
1 There is at most one conformance path from D to A.
2 There are two or more conformance paths, and the Parent clause for
exactly one of them in D has a Select clause listing the name of the
version of f from the corresponding parent

The version implies rename too. If i get the next inheritance hierarchy:
D inherit of B
D inherit of C
B y C inherit of A

A has a "f"  feature and B rename f as fb (not redefine,only rename)
i need use select clause in D. ¿is it ok?

Thank in advance




------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/eiffel_software/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/eiffel_software/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:eiffel_software-digest@...
    mailto:eiffel_software-fullfeatured@...

<*> To unsubscribe from this group, send an email to:
    eiffel_software-unsubscribe@...

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

Helmut Brandl
Re: ECMA select: redeclare or rename
Reply Threaded More
Print post
Permalink


federico_olivia wrote:

> The ECMA standard say:
> Validity: Repeated Inheritance Consistency constraint
>  It is valid for a class D to have two or more versions of a feature f  
> of a proper ancestor A if and only if it satisfies one of the following
> conditions:
> 1 There is at most one conformance path from D to A.
> 2 There are two or more conformance paths, and the Parent clause for
> exactly one of them in D has a Select clause listing the name of the
> version of f from the corresponding parent
>
> The version implies rename too. If i get the next inheritance hierarchy:
> D inherit of B
> D inherit of C
> B y C inherit of A
>
> A has a "f"  feature and B rename f as fb (not redefine,only rename)
> i need use select clause in D. ¿is it ok?
>
> Thank in advance
>
>  
I think so. Because D has now the features "f" and "fb", both inherited
repeatedly from A. Under dynamic bind with a call {A}.f it has to be
disambiguated. A select clause in D does exactly this. You select which
feature to call under the conditions of dynamic bind.

Hope this helps.

Helmut
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
>  

------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/eiffel_software/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/eiffel_software/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:eiffel_software-digest@...
    mailto:eiffel_software-fullfeatured@...

<*> To unsubscribe from this group, send an email to:
    eiffel_software-unsubscribe@...

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

federico_olivia
Re: ECMA select: redeclare or rename
Reply Threaded More
Print post
Permalink
--- In eiffel_software@..., Helmut Brandl
<helmut.brandl@...> wrote:
>
>
>
> federico_olivia wrote:
> > The ECMA standard say:
> > Validity: Repeated Inheritance Consistency constraint
> >  It is valid for a class D to have two or more versions of a
feature f  
> > of a proper ancestor A if and only if it satisfies one of the
following
> > conditions:
> > 1 There is at most one conformance path from D to A.
> > 2 There are two or more conformance paths, and the Parent clause
for
> > exactly one of them in D has a Select clause listing the name of
the
> > version of f from the corresponding parent
> >
> > The version implies rename too. If i get the next inheritance
hierarchy:
> > D inherit of B
> > D inherit of C
> > B y C inherit of A
> >
> > A has a "f"  feature and B rename f as fb (not redefine,only
rename)
> > i need use select clause in D. ¿is it ok?
> >
> > Thank in advance
> >
> >  
> I think so. Because D has now the features "f" and "fb", both
inherited
> repeatedly from A. Under dynamic bind with a call {A}.f it has to
be
> disambiguated. A select clause in D does exactly this. You select
which
> feature to call under the conditions of dynamic bind.
>
> Hope this helps.
>
> Helmut
> >
Hi Helmut,

They are duplicates if are attributes not if are routines.  In fact
both are the same rutine. Which is the ambiguedad then?  

regards
PD. EiffelStudio say that select is necesary.


------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/eiffel_software/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/eiffel_software/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:eiffel_software-digest@...
    mailto:eiffel_software-fullfeatured@...

<*> To unsubscribe from this group, send an email to:
    eiffel_software-unsubscribe@...

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

Helmut Brandl
Re: Re: ECMA select: redeclare or rename
Reply Threaded More
Print post
Permalink

> They are duplicates if are attributes not if are routines.  In fact
> both are the same rutine. Which is the ambiguedad then?  
>
>
>  
Attribute or routine is not important. If you inherit a feature under 2
different names (that is what you did) you have replication, i.e. you
have 2 features. In case of a routine this is true also. If you
redefined the routine along one path the routines have different code,
if you didn't redefine, you have 2 routines with the same
implementation. But you have *2* routines.

Under dynamic bind it has to be clear, which one you want to call.
Therefore the select is necessary. You can avoid the select only if you
define one inheritance path as nonconformant (via inherit {NONE}). I
don't know, if non conformant inheritance is already implemented in
Eiffelstudio.

Note that any descendant of D can redefine the 2 routines independantly.

------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/eiffel_software/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/eiffel_software/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:eiffel_software-digest@...
    mailto:eiffel_software-fullfeatured@...

<*> To unsubscribe from this group, send an email to:
    eiffel_software-unsubscribe@...

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

federico_olivia
Re: Re: ECMA select: redeclare or rename
Reply Threaded More
Print post
Permalink
In reply to this post by federico_olivia

<helmut.brandl@...> wrote:
> Attribute or routine is not important. If you inherit a feature under
2
> different names (that is what you did) you have replication, i.e. you
> have 2 features. In case of a routine this is true also. If you
> redefined the routine along one path the routines have different
code,
> if you didn't redefine, you have 2 routines with the same
> implementation. But you have *2* routines.
>
> Under dynamic bind it has to be clear, which one you want to call.
> Therefore the select is necessary. You can avoid the select only if
you
> define one inheritance path as nonconformant (via inherit {NONE}). I
> don't know, if non conformant inheritance is already implemented in
> Eiffelstudio.

The question is: i have 2 routines or one routine with two names?

OOSC (pag 553) say:

There remains to consider the case of conflicting redefinitions under
replication, that is to say when the repeated descendant inherits the  
separately "redefined" features with different names, and they are both
effective.

I remark "redefine" because rename not is redefine and then not there
are replication and conflict.

Select rule (OOSC pag 555):
A class that inherits two o more different effective versions of a
feature from a repeated ancestor, and does not redefine them both, must
include exactly of then in a select clause.

The rule say two "different versions" in may case are only one versión.

Best regards
PD. I know not conformant inheritance but not is the case.






------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/eiffel_software/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/eiffel_software/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:eiffel_software-digest@...
    mailto:eiffel_software-fullfeatured@...

<*> To unsubscribe from this group, send an email to:
    eiffel_software-unsubscribe@...

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

Andrew Robson-2
Re: Re: ECMA select: redeclare or rename
Reply Threaded More
Print post
Permalink
This is an issue of repeated inheritance, check page 546.

"In a repeated descendant, versions of a repeatedly inherited feature
inherited underthe same name represent a single feature, Versions
inherited under different names represent separate features, each
replicated from the original in the common ancestor."

So even though the two features may be exactly the same due to the
renaming they are both separate features and either redefinition or a
select clause will need to be used.




On Sat, Jun 28, 2008 at 4:00 PM, federico_olivia
<federico_olivia@...> wrote:

>
> <helmut.brandl@...> wrote:
>> Attribute or routine is not important. If you inherit a feature under
> 2
>> different names (that is what you did) you have replication, i.e. you
>> have 2 features. In case of a routine this is true also. If you
>> redefined the routine along one path the routines have different
> code,
>> if you didn't redefine, you have 2 routines with the same
>> implementation. But you have *2* routines.
>>
>> Under dynamic bind it has to be clear, which one you want to call.
>> Therefore the select is necessary. You can avoid the select only if
> you
>> define one inheritance path as nonconformant (via inherit {NONE}). I
>> don't know, if non conformant inheritance is already implemented in
>> Eiffelstudio.
>
> The question is: i have 2 routines or one routine with two names?
>
> OOSC (pag 553) say:
>
> There remains to consider the case of conflicting redefinitions under
> replication, that is to say when the repeated descendant inherits the
> separately "redefined" features with different names, and they are both
> effective.
>
> I remark "redefine" because rename not is redefine and then not there
> are replication and conflict.
>
> Select rule (OOSC pag 555):
> A class that inherits two o more different effective versions of a
> feature from a repeated ancestor, and does not redefine them both, must
> include exactly of then in a select clause.
>
> The rule say two "different versions" in may case are only one versión.
>
> Best regards
> PD. I know not conformant inheritance but not is the case.
>
>

------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/eiffel_software/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/eiffel_software/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:eiffel_software-digest@...
    mailto:eiffel_software-fullfeatured@...

<*> To unsubscribe from this group, send an email to:
    eiffel_software-unsubscribe@...

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

Helmut Brandl
Re: Re: ECMA select: redeclare or rename
Reply Threaded More
Print post
Permalink
In reply to this post by federico_olivia

> The question is: i have 2 routines or one routine with two names?
>
>
>  
If you have 2 names, you have also two features. In case of replicated
inheritance these are versions. Let me give you an example to see why
select is necessary. I will extend your example

class A feature f .... end

class B inherit A ... end

class C inherit A rename f as fb end ... end

class D inherit B C ... end

Up to now D has the features f and fb, which are versions of f inherited
repeatedly from A. If f is a routine, f and fb have the same code.
Therefore at first glance a select does not seem to be necessary.

However you can continue like

class E inherit D redefine fb end  ... end

Now E has features f and fb, which have different implementations. But
in E you have no chance to select, because E has only one parent. The
select has to be in D. It is a principle in Eiffel that the code has to
be valid independantly of the future descendants.

Therefore whether you really have an E or not is not important. D needs
the select in order to be valid.

Did I express myself clearly now?

Regards
Helmut


------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/eiffel_software/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/eiffel_software/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:eiffel_software-digest@...
    mailto:eiffel_software-fullfeatured@...

<*> To unsubscribe from this group, send an email to:
    eiffel_software-unsubscribe@...

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

federico_olivia
Re: ECMA select: redeclare or rename
Reply Threaded More
Print post
Permalink
Thank you Helmut!! I see the point now!!

Regards
--- In eiffel_software@..., Helmut Brandl
<helmut.brandl@...> wrote:
>
>
> > The question is: i have 2 routines or one routine with two names?
> >
> >
> >  
> If you have 2 names, you have also two features. In case of
replicated
> inheritance these are versions. Let me give you an example to see
why

> select is necessary. I will extend your example
>
> class A feature f .... end
>
> class B inherit A ... end
>
> class C inherit A rename f as fb end ... end
>
> class D inherit B C ... end
>
> Up to now D has the features f and fb, which are versions of f
inherited
> repeatedly from A. If f is a routine, f and fb have the same code.
> Therefore at first glance a select does not seem to be necessary.
>
> However you can continue like
>
> class E inherit D redefine fb end  ... end
>
> Now E has features f and fb, which have different implementations.
But
> in E you have no chance to select, because E has only one parent.
The
> select has to be in D. It is a principle in Eiffel that the code
has to
> be valid independantly of the future descendants.
>
> Therefore whether you really have an E or not is not important. D
needs
> the select in order to be valid.
>
> Did I express myself clearly now?
>
> Regards
> Helmut
>



------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/eiffel_software/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/eiffel_software/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:eiffel_software-digest@...
    mailto:eiffel_software-fullfeatured@...

<*> To unsubscribe from this group, send an email to:
    eiffel_software-unsubscribe@...

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/