|P is for Practical|
Re: wishlist: die-on-failure for built-insby Mabooka-Mabooka (Sexton)
|on Apr 19, 2005 at 04:21 UTC||Need Help??|
I'll try to be very careful not to disturbe piece in the monastery. Intuition tells that this will be a tough errand...
First of all: why build-ins only? Don't you want all your subs to do the same? And if not - why?
Second: if what you wish were possible (and easy), that wouldn't work, you'd wish your wish back. Sometimes you want it to die, sometimes - do smth. else. E.g.:
I think this whole problem is illusive, artificial and leads astray. Even worse; it hides the real problem. The real problem is: having a programming discipline. Monks must know what dicipline means, right? If one dont's check EVERY RESULT OF EVERY SINGLE CALL, whatever is the language, -- well I say (s)he still has a lot to learn.
Now, the most dangerous part. This ~shouldn't~ have anything to do with Perl. Seems that somehow it does. I'd really like to hear a scientific explanation. My best guess is: "Less typing" is a very popular paradigm among Perl programmers. Historical reasons? philosophical?..
In other words, a solution:
doesn't even come to mind. (!!!!!!!)
Well, less typing won't save you your development time. On the contrary.
I often see one line of code where I would *automatically* without thinking type six. E.g.: ...
Instead, many people type only the 2nd line, some - 1st and 2nd, more rare - also 3d and 4th, and almost nobody - 5th and 6th.
Well you know what: those few extra lines save weeks of debugging.
So from all points of view the answer is very simple: get used to typing more.
Now, when you get to the discipline to always surround any call with if() or if(!...) or die unless..., only then the question "How to type less?" should be risen. There're plenty of techiques for achieving that...:-).
PS: Coding for production vs. "prototyping and for one-off scripts" in two different styles is IMHO also a terrible mistake. This way, you'll strep into same traps twice.
Sorry for such a long and emotional post. Just spent a weekend cleaning up smb. else's mess....