From: <an...@io...> - 2005-06-28 20:16:56
|
Nice to hear from you Chris! :) I didn't realise I had send that many mails - huh.. I feel like I'm flooded with the replies even though the mails I personally wrote were even longer, so I can't imagine how you managed to handle those in such a short time :) Well given the amount of sole crap I wrote too hastily (which I since discovered while acually doing stuff and not just rolling around in thoughts and browsing code), the fact that you know OI2 "a bit better" and are a native english speaker might have something to do with that - but still I do give you a huge credit for what you managed to do :) But now for the actual stuff - I'll keep the emails separate since they handle different areas (and I don't probably have the time to answer them all just now). >> But I'm still not sure about the error on lookup failure.. > > It's tricky: throwing an exception when you cannot find an action > makes for nice execution flow -- you can just catch the exception at > a higher level, and if you're writing code where you're actively > looking for an action it's pretty easy to just catch the exception. Yes that is true, but the problem is that the error gets logged anyway since the exception is always thrown after: $log_act->error( $msg ); > However, I agree that looking up an action might not be the best > place for an exception (conceptually speaking). We'd have to do quite > a bit of retrofitting to make this happen... I dunno, has this > bothered anyone else? Well in my opinnion it's a difference in how you see the purpose of the function. If you see it just as a means to change a known name to the corresponding action object, then throwing an exception is a good idea when this turns out not to be possible. On the other hand if you see it as a function to look up and return the action that is registered for the given name, then it would be reasonable to just quietly return nothing if there was no actual failure but the name jst wasn't registered to any acions. I personally don't think that you should actually change the logic and get rid of exceptions since they are a really handy way of doing things. I just don't want a mandatory error in my logs when it happens :) Anyway for me "lookup_action" somewhat sounds like it would be the latter one. I might be wrong here since I'm not a native speaker. - Antti |