[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: __close and nil error
- From: John Belmonte <john@...>
- Date: Sun, 25 Sep 2022 21:51:29 +0900
I noticed a possible issue of the __close metamethod: nil is a valid value for raising errors, but __close cannot distinguish between nil error and no error.
Other functions passing errors (pcall, etc.) seem to use a status + err tuple, so the cases can be distinguished.
Since the manual says "nil and false are ignored as to-be-closed values", I wonder if the first arg of __close can be overloaded to convey the error case, by the value false, which otherwise can't happen.