REBOL3 tracker
  0.9.12 beta
Ticket #0001491 User: anonymous

Project:



rss
TypeWish Statuscomplete Date10-Feb-2010 08:59
Versionalpha 97 CategoryDocumentation Submitted byLadislav
PlatformAll Severityminor Prioritynormal

Summary The "throws an error" idiom used in documentation
Description In the current documentation, there is a lot of places, where the above idiom is used. I find it confusing. See the code examples below.

Since the behaviour is not equivalent, the idioms "an error was caused (or, an error was triggered, if you prefer)" and "an error was thrown" should not be used interchangeably.
Example code
do-example: func [code [block!]] [
    try/except [if error? catch code ["an error was thrown"]] ["an error was caused"]
]
    
; example #1
do-example [1 / 0]
; == "an error was caused"

; example #2
do-example [throw make error! ""]
; == "an error was thrown"

Assigned ton/a Fixed in- Last Update18-Aug-2013 13:53


Comments
(0002021)
BrianH
11-Feb-2010 19:15

This is another R2'ism that should be reworded. There is a distinction between making an error and causing the error to be thrown (though not by THROW, hence the confusion). Perhaps "triggered"?
(0002025)
Ladislav
13-Feb-2010 04:25

I do not see it as an R2-ism. In R2 the same distinction exists. "An error is thrown" - certainly, it is used in CS, but it does not look adequate in Rebol where the Throw function exists and does something else.
(0002026)
BrianH
14-Feb-2010 02:06

Strangely enough, THROW, RETURN, EXIT, HALT and QUIT use exactly the same mechanism as error triggering in R3 - just different error codes. Errors really are thrown in R3 when they are triggered, the same way that THROW throws values. This is probably not true in R2, but there the THROW function is explicitly called to throw errors within functions with a [catch] attribute (hence the "R2'ism" comment).

But for the average REBOL developer that might be confusing, a matter of low-level R3 trivia. Changing the docs to use less confusing terms makes sense, even when they are technically accurate now.
(0002030)
Ladislav
15-Feb-2010 16:27

"...just different error codes...", yes, and not *just* that. That (as well as the above examples) is what I describe saying "the Throw function does something else", than a Do (trigger) function would do, when obtaining an error as an argument value.
(0003468)
Ladislav
19-Feb-2013 14:47

Pull request submitted.

Date User Field Action Change
18-Aug-2013 13:53 Ladislav Status Modified pending => complete
19-Feb-2013 14:47 Ladislav Status Modified reviewed => pending
19-Feb-2013 14:47 Ladislav Comment : 0003468 Added -
9-Mar-2010 10:25 Ladislav Description Modified -
9-Mar-2010 10:24 Ladislav Comment : 0002025 Modified -
15-Feb-2010 16:28 Ladislav Comment : 0002030 Modified -
15-Feb-2010 16:27 Ladislav Comment : 0002030 Added -
14-Feb-2010 02:06 BrianH Comment : 0002026 Added -
13-Feb-2010 04:25 Ladislav Comment : 0002025 Added -
11-Feb-2010 19:15 BrianH Comment : 0002021 Added -
11-Feb-2010 19:12 BrianH Status Modified submitted => reviewed
10-Feb-2010 09:12 Ladislav Description Modified -
10-Feb-2010 09:12 Ladislav Code Modified -
10-Feb-2010 08:59 Ladislav Ticket Added -