in reply to Re^8: Non-fatal error handling with Mouse types?
in thread Non-fatal error handling with Mouse types?

"did not solicit feedback on"

But you did solicit feedback on your attempts to use Moosey type contraints in an update to the code you are undertaking. I stand by my responses; type constraints are for stopping compilation or execution of your program, and if you don't want to stop, don't use a constraint. You mentioned setting $Errstr or similar but that is only done in case of exception: packages that permit the flow to continue use a warning variable. If you want to do that it's of course perfectly fine, but using type constraints is the wrong approach as shown by your attempts and the workarounds you've been provided here.

So my feeble contributions have all been with the intent of helping you with your original question. Sometimes the right answer to "how do I do this?" is "don't."

But, did you look at coercions? Wouldn't correcting a bad value be even better than allowing it? Your coercion can also set or emit a warning if the value needs to be coerced in order to meet the constraint ... ?


The way forward always starts with a minimal test.

Replies are listed 'Best First'.
Re^10: Non-fatal error handling with Mouse types?
by wanna_code_perl (Friar) on Oct 02, 2019 at 16:47 UTC

    I appreciate your advice, really, but by now you must know I already know what you're talking about, and that your advice covers a design decision that was already made several steps back in the development process from where I am today. It's much like telling me I really should go to see Star Wars when I just need to know how to get to the theater for The Avengers tickets I have in my hand. Maybe you're right, and Star Wars is better. And maybe I even agree with you, but my wife bought the tickets online last week and arguing now would be pointless and possibly even bad for my marriage.

    Thinking outside the box and looking for XY problems is great. I encourage it, I welcome it. We all need a sanity check now and then. You made your point pretty well eight or nine replies ago, and I'm fresh out of ways to try to either stupidly defend the efficacy of the existing software that I didn't design, or let you know "I agree in general, but my example is specific, and you're ten years and two developers too late for this kind of advice". So I'm not sure about you, but I'm about ready to call it a day and make myself a sandwich. Want one?

    Edit: And, sorry I just about missed this twice, but yes, your point about coercions is well made.