Re: Xcode -> Eclipse migration problem

From: Mike Schrag (mschra..dimension.com)
Date: Fri Oct 19 2007 - 21:52:54 EDT

  • Next message: Mike Schrag: "Re: Xcode -> Eclipse migration problem"

    "Preferred" is of course relative :) There are definitely classes of
    validations that are impossible to determine statically, like the
    case you're referring to. In these situations, "// VALID" is really
    one of your only options. If this happens VERY frequently, you can
    also declare "hardware\.cpuType" (or "hardware\..*") to be a valid
    binding in the Binding Validation preferences pane (I think there are
    some examples built-in by default). That said, most of these cases
    are at least red flags for me. 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. If
    this is true of every branch of execution of the component, I would
    probably recommend making the type explicitly Computer in your
    component and let the Java type system work for you (you get
    completion, which is always nice). However, it's also possible that
    you have conditional checks inside your component and you branch and
    call hardware.cpuType only if it is a Computer and only in certain
    parts of your component, in which case it may not make sense to
    declare the actual type to be Computer in your component. 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.

    ms

    On Oct 19, 2007, at 9:31 PM, Art Isbell wrote:

    > On Oct 19, 2007, at 3:21 PM, Art Isbell wrote:
    >
    >> But WOLips' Component Editor understandably doesn't recognize
    >> bindings like hardware.cpuType because cpuType() is a Computer,
    >> not Hardware method. This works fine at run-time. How do I tell
    >> Component Editor to warn me about this rather than labeling this
    >> as an error?
    >
    > Of course, I found one answer shortly after sending my previous
    > message: append "// VALID" to the wod statement causing the
    > "bogus" error. Is this the preferred approach?
    >
    > Aloha,
    > Art
    >



    This archive was generated by hypermail 2.0.0 : Fri Oct 19 2007 - 21:54:10 EDT