Re: English language basis for throw
Peter Scott wrote: Only one of them needs to be right. As long as one is right, there is no problem. Right, I was just pointing out that it's harder for people to divine which one we picked without recourse to the documentation. Yes; unfortunately, this problem exists generally, especially wrt Perl. :-/ -- John Porter
Re: English language basis for throw
[EMAIL PROTECTED] writes: Please take this discussion to the new -errors sublist. Thanks in advance! Exceptions are not necessarily errors. This belongs in perl-language-flow surely? -- Piers
Re: English language basis for throw
Peter Scott wrote: At 05:33 PM 8/15/00 -0400, John Porter wrote: The thing I don't like about C++/Java try/catch syntax is the way the blocks are daisychained. That is not intuitive to the flow. I find it quite intuitive :-) I note the smiley. What interpretation should be placed on statements in the try block following a catch block? Whatever you want. I can think of three possibilities. -- John Porter
Re: English language basis for throw
Bart Lateur wrote: To me, a program is much like a maze, a multilevel walk in an old castle. And if you commit a faux pas of some kind, the guards show up and "throw" you off the north tower. -- David Nicol 816.235.1187 [EMAIL PROTECTED] Useless use of a void in constant context
Re: English language basis for throw
On Mon, 14 Aug 2000 12:32:32 -0500, David L. Nicol wrote: I find "throw" to be a perfectly good synonym for "raise" an exception. The english language equivalent is a piece of steel machinery, when it breaks while running, which is said to "throw a rod" or "throw a bolt" depending of course on the nature of the broken item that comes flying out of the mechanism at dangerous and possibly inventor-fatal speeds. Your explanation makes it sound as if the program can just blow up in your face. I sure hope that error trapping goes in a somewhat more controlled manner. I find it preferable to "die" which has always struck me as morbid, even if it does echo the equally objectionable unix "kill." N to me, "die" just means it simply stops working. Nothing blowing up. Just to make sure some opposition is heard: I've always thought of "throw" as very silly word. To me, a program is much like a maze, a multilevel walk in an old castle. There are unexpected trapdoors, but as long as they stay closed, you can simply continue. If such a trapdoor open, you fall through, someimes through several floors, until somewhere you encounter a safety net: you were caught. You can continue from there. If there was no safety net, you keep falling, well, into the water, out of the castle (er, "program".) An error is not a ball. -- Bart.
Re: English language basis for throw
At 05:06 PM 8/15/00 -0400, John Porter wrote: I think about the word some OO gurus use: "raise". I think that came from the kernel or hardware people before OO was around. Something about raising and lowering IPLs. -- Peter Scott Pacific Systems Design Technologies
Re: English language basis for throw
At 05:33 PM 8/15/00 -0400, John Porter wrote: The thing I don't like about C++/Java try/catch syntax is the way the blocks are daisychained. That is not intuitive to the flow. I find it quite intuitive :-) The exception handlers should be more closely bound -- syntactically -- to the try block. A switch statement would be closer; but I think an OO syntax would be better. You know, something like try { cough "outa here"; catch { matawba = { sustain; }, ebola = { overrule; }, { punt; } } } What interpretation should be placed on statements in the try block following a catch block? -- Peter Scott Pacific Systems Design Technologies
Re: English language basis for throw
Lightning flashed, thunder crashed and Dan Sugalski [EMAIL PROTECTED] whispered: | At 04:03 PM 8/15/00 -0500, Jarkko Hietaniemi wrote: | open, you fall through, someimes through several floors, until somewhere | you encounter a safety net: you were caught. You can continue from | there. If there was no safety net, you keep falling, well, into the | water, out of the castle (er, "program".) | | Hmmm...trip() and trap()? fail() and deal()? | | freak() (or panic) and cope(). I think fail() and handle() are good. Something fail()ed and it was handle()d by an exception. -spp
Re: English language basis for throw
"Stephen P. Potter" wrote: I think fail() and handle() are good. Something fail()ed and it was handle()d by an exception. Fail is no good, because exceptions can be used to indicate success. Just because you don't isn't a counter-argument. Exceptions are *not* the same as errors, that's just one semantic mapping. Consider the following case. You've got some complicated algorithm that doesn't normally succeed in finding an answer. When it does find an answer, it can be all over the place, but no matter what, you want to stop the algorithm and return the answer. When you succeed, you want to say throw Exception::MySuccess object = $answer_object; not fail Exception::MySuccess object = $answer_object; and then invoke the whole algorithm under: my $answer; try { my_algorithm; } catch Exception::MySuccess { $answer = $@-object; } If my_algorithm finds the answer then $answer contains the answer, otherwise $answer is undef. If my_algorithm throws anything but an Exception::MySuccess (such as an otherwise uncaught internal Perl error), the statement after the catch is not executed at all. That's why all the other words with negative connotation are bad choices for throw. It's up to the catcher to determine what's good and what's bad, not the thrower. The "classical" uses of try/throw/catch/finally have been around for many years. During that time, many languages have incorported the concepts, and after much heat and little light, the terminology. Could it be that's because, *all* things considered, it is good terminology? Consider "finally" vs. "always". Always? Even if force majeur? Finally simply means, "as the final act of the unwind processing". By the way, this discussion has moved to perl-language-errors, so the good folks here at perl-language-flow can concentrate on finding silly words for other Perl flow-control constructs ;-) Yours, c, Tony Olekshy
English language basis for throw
Dan Sugalski wrote: perl cribs from english as much as any other language, spending some time to get names that fit well makes perfect sense, especially since most of the perl programmers that start using this won't be coming with huge gobs of experience from languages that already do it. I find "throw" to be a perfectly good synonym for "raise" an exception. The english language equivalent is a piece of steel machinery, when it breaks while running, which is said to "throw a rod" or "throw a bolt" depending of course on the nature of the broken item that comes flying out of the mechanism at dangerous and possibly inventor-fatal speeds. I find it preferable to "die" which has always struck me as morbid, even if it does echo the equally objectionable unix "kill." "Killing to send a signal" sounds like La Casa Nostra or president Clinton flying over Bosnia. (Opposed to, for instance, LBJ, who killed because he got residuals on the damn bombs) (my source is a vietnam-era veteran hitchhiker I picked up while on summer vacation this year) Because of the MTOWTDI nature of the Perl experiment, eventually there will be perl programmers trying to make sense of C++ and Java(?) nomenclature in which one throws exceptions and catches them with exception handlers. This language (throw, catch) seems natural and I have seen no viable alternative on this mailing list (although it is very possible that it was at the bottom of a thread I abandoned after reading the first ten on-topic messages.) and I have begun using it in "perl6 example code" included in my RFC submissions. -- David Nicol 816.235.1187 [EMAIL PROTECTED] :wq