Ed Leafe wrote: > On Jun 30, 2008, at 3:19 PM, Paul McNett wrote: > >> The failure is at the point of the problem, making it very easy to >> understand what's going on. > > I guess I don't see the current situation as all that confusing or > hard to track down. Since I'm at work now I can't fire up Dabo and > start debugging; I was planning on doing that tonight when I got home. > > It also isn't reasonable to assume that we know just those places > where there may be incorrect types. We would then have to adopt the > convention of adding asserts to all of our code. My personal belief is > that these sorts of asserts are for testing values supplied via > external sources; if it's coming from our own code, then the problem > is the code, and that's what we should focus on.
The property setter doesn't know if it is coming from an external source or not. The purpose of the assert at the point of the property setter is that it would forbid the setting of the property to an unexpected type or value, no matter who is doing the setting of the property. In the case of the Order property, it was being set to a string and then *later on* the exception was happening. IOW, the setter allowed the setting to a string, but later code relied on it being an int. >> But my real question was more general: do we enforce correct types >> to be >> passed, or do we coerce to the expected type? > > > It depends. In the case of values coming from XML attributes, we > don't have a choice: everything needs to be stored as a string. Of course. XML is a text file so XML is text. > However, those string values should be converted to the correct type > before assignment. They should be converted at the I/O interface, which I believe we are already doing. > We shouldn't have type coercion in our setters as a > general practice. Okay, I think I'm reading this as weak agreement to the value of adding asserts. Which is pretty close to my feeling, too. Paul _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev Searchable Archives: http://leafe.com/archives/search/dabo-dev This message: http://leafe.com/archives/byMID/[EMAIL PROTECTED]
