Re: Xcode -> Eclipse migration problem

From: Anjo Krank (kran..ogicunited.com)
Date: Sat Oct 20 2007 - 01:16:13 EDT

  • Next message: Jean Pierre Malrieu: "Re: useful or terrible ... you be the judge"

    You can always do a

    public Computer computer() {
       return (Computer)hardware();
    }

    and bind to that... if you get a CCE or a UnknownKeyException
    shouldn't make much of a difference...

    Cheers, Anjo

    Am 20.10.2007 um 04:07 schrieb Art Isbell:

    > On Oct 19, 2007, at 3:52 PM, Mike Schrag wrote:
    >
    >> This is entirely a personal design preference, because (as you
    >> mention) this is perfectly legitimate WO code, but you are
    >> definitely cheating Java's type system. Based on your binding, it
    >> would appear that your component has an ivar of type Hardware, but
    >> your component is presuming it to be a Computer.
    >
    > The HardwareManagement component correctly assumes that "hardware"
    > is a Hardware type. If I made it a Computer type so that Component
    > Editor would be happy and assigned a Hardware object to it as would
    > be correct in HardwareManagement, then the Java compiler wouldn't
    > be happy or it wouldn't catch incorrect Computer-only messages sent
    > to the Hardware object. This must be a fairly common situation in
    > O-O programming, but I may not know the best way to handle it.
    >
    >> For my money, the most narrow type declaration almost always wins
    >> out, because there are so many benefits that WOLips/Eclipse can
    >> provide when done that way.
    >
    >
    > Hardware is the most narrow type declaration, but that is what is
    > causing Component Editor to complain. I'd like to do something
    > reasonable in the Java side to make this work well rather than
    > flagging wod bindings with "// VALID", but I just don't know what
    > to do on the Java side other than what I'm doing which is casting
    > "hardware" to Computer in the ComputerManagement component in which
    > I know "hardware" will always be a Computer.
    >
    > Aloha,
    > Art
    >



    This archive was generated by hypermail 2.0.0 : Sat Oct 20 2007 - 01:17:30 EDT