Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Eiffel > Re: Precursor, ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 7 Topic 851 of 913
Post > Topic >>

Re: Precursor, symmetry of is_equal

by Georg Bauhaus <bauhaus@[EMAIL PROTECTED] > Feb 16, 2007 at 05:56 PM

On Thu, 2007-02-15 at 09:32 -0800, Daniel F Moisset wrote:

> Result := Precursor (other)
> 
> which executes the Precursor of is_equal (the one defined in PARENT).
> This call returns True, and then checks its postcondition "symmetric".
> Given that Result = True, it checks that "other.is_equal (Current)".
> That call, given that Current and other are different  (and
> CHILD.is_equal checks that property which makes them different after
> the call to Precursor), returns False, so we have a postcondition
> failure.
> 
> So, my question is:
>  * Is this a language gotcha? (I found this weird, didn't know about
> it)

I guess it is.

>  * Is it a bug of my implementation, because calls from Precursor call
> should be made using the Precursor type instead of dynamic type (sound
> very non-OOish, but would make this case work)

I don't think so, if Precursor is inherited covariantly. Then the
"Precursor type" isn't PARENT (which I think is also what Peter Horan
says), and other is alway polymorphic within is_equal anyway...
I like it when I can name the specific type of
an object when I know it, why not? I tried with "if same_type(other)"
and/or expanded objects of types PARENT and ANY, hoping I could
make objects of a statically known type for comparison,
but didn't get really far. (BTW assignment between expanded and
reference isn't accepted by the compiler in
  expanded_obj := obj_ref
Has there been a change?)


>  * Is this a conceptual mistake of mine, the way I am trying to do
> things?

Is there a way to invoke a specific routine x.f up x's type
hierarchy? If not, then I think the post-condition says something
about possibly different objects, really.




 7 Posts in Topic:
Precursor, symmetry of is_equal
"Daniel F Moisset&qu  2007-02-15 09:32:28 
Re: Precursor, symmetry of is_equal
Peter Horan <peter@[EM  2007-02-16 00:17:26 
Re: Precursor, symmetry of is_equal
Georg Bauhaus <bauhaus  2007-02-16 17:56:42 
Re: Precursor, symmetry of is_equal
Roger Browne <roger@[E  2007-02-16 17:19:06 
Re: Precursor, symmetry of is_equal
"Daniel F Moisset&qu  2007-02-16 12:59:17 
Re: Precursor, symmetry of is_equal
Gerald Hammer <hammer@  2007-02-17 10:54:41 
Re: Precursor, symmetry of is_equal
Gerald Hammer <hammer@  2007-02-23 10:32:31 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat May 17 1:08:57 CDT 2008.