|
On 20/05/2020 15:35, Ahmed Charles wrote:
On May 19, 2020, at 3:43 AM, Lorenzo Donati <lorenzodonatibz@tiscali.it> wrote: Hi Lua Team! The description of `error` says: "Terminates the last protected function called and returns message as the error object. This function never returns." Which is quite confusing (especially for newbies). I'd suggest a change like: "Terminates the last protected function called and raises (throws?) an error having message as the error object. This function never returns."The issue with raise/throw is that those tend to imply that a catch happens after, but the first word in this sentence is terminates. Terminates refers to the corresponding pcall and therefore the verb in the second half of the sentence also does, which means that pcall returns not error. The error function causes pcall to terminate and return.
Ok, but in this case I think there is a grammatical issue, since what you write is not what you mean.
In fact the grammatical subject for the two verbs "Terminates" and "returns" is the same and is implicit (i.e. "function error"), so I don't think someone could infer (gramatically speaking) that "returns" may not refer to "error", but to the mentioned protected call, since this latter is not the grammatical subject of either verbs.
But I'm not a native speaker, so I'd welcome the opinions of native speakers on the subject (pun not intended :-).
Anyway, may I suggest a change in the same spirit of what you just told me in your reply? I.e.:
"Terminates the last protected function called and causes pcall to return message...etc." or"Terminates the last protected function call and causes it [the protected call] to return message...etc."
A couple of additional words, but plain and clear nonetheless.
Generally speaking, I prefer the terseness of the manual. It’s not meant to be a tutorial or newbie friendly.
Fair enough. -- Lorenzo