Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
Non-conforming inheritance and the meaning of "Current"
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  1 message - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
dmois...@except.com.ar  
View profile  
 More options Apr 26 2005, 10:12 am
Newsgroups: comp.lang.eiffel
From: dmois...@except.com.ar
Date: 26 Apr 2005 07:12:07 -0700
Local: Tues, Apr 26 2005 10:12 am
Subject: Non-conforming inheritance and the meaning of "Current"
Recently, I read a thread at the SmartEiffel mailing list from Frank
Salter (you can check it at
http://wwsympa.loria.fr/wwsympa/arc/smarteiffel/2005-04/msg00112.html
), where a problem with non-conforming inheritance (inherit expanded,
inherit {NONE}, insert, or your favourite name this week) is shown.
This is not an SE bug or implementation issue, but a language design
problem instead.

The problem is that non-conforming inheritance breaks the meaning that
'Current' had in the ancestor, because its type changes randomly. The
general pattern is

class SOME_CLASS
feature some_feature (arg: NON_CONFORMING_PARENT) is ...
end

class NON_CONFORMING_PARENT
feature
    s: SOME_CLASS

    anchor: like Current -- this will bring problems

    routine (arg: like Current) is
        do
            s.some_feature (Current) -- This just fine here
            s.some_feature (anchor) -- This just fine here
            s.some_feature (arg) -- This just fine here
        end
end

The class "NON_CONFORMING_PARENT" is well typed, according to the
classic (ETL2) language rules. Now let's introduce non-conforming
inheritance to the game:

class UNRECOGNIZED_SON
insert NON_CONFORMING_PARENT -- SE notation
-- inherit {NONE} NON_CONFORMING_PARENT -- ETL3 notation
end

Now the problem should be obvious. All the code from the parent
referring to Current, or anything anchored to Current, is now badly
typed. This is because, it breaks the normal Eiffel rule that made all
types of expressions go down (or stay at the same place) when
inheriting (i.e. covariance). When inheriting non-conformingly, the
type of Current doesn't go down, nor up, but changes randomly.

Is there anyone researching into this language design problem? Any
ideas about how to solve it without throwing NCI away (which, at a
glance, seems like a very useful tool)?

Before I finish this post, let me show you an extract coming from real
code:

class LINKED_LIST

inherit
    COLLECTION
        redefine copy end

feature
    from_collection (other: COLLECTION) is ...

    copy (other: like Current) is
        do
            from_collection (other) -- Correct here
            -- but incorrect in unrecognized children
        end
-- ...
end

The above code seems fine (and it is), but it makes impossible to
inherit non-conformingly from LINKED_LIST

Any ideas?

               Daniel


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »