lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Change a single word:
  "Terminates the last protected function called **and** returns message as the error object."
to
  "Terminates the last protected function called **which** returns message as the error object."

The grammatical subject of the verb "Terminates", i.e. the error() function itself (which by itself never returns to its caller), is definitely never the subject of the verb "returns" in that sentence.
So yes the sentence is confusive and even wrong, using standard English syntax.





Le mer. 20 mai 2020 à 15:35, Ahmed Charles <acharles@outlook.com> a écrit :


> 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.

Generally speaking, I prefer the terseness of the manual. It’s not meant to be a tutorial or newbie friendly.