[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Colon notation in object-oriented programming
- From: David Favro <lua@...>
- Date: Sun, 5 Mar 2017 22:10:02 -0500
On 03/05/2017 06:40 PM, Xavier Wang wrote:
It should be:
when you use in production code.
This should *not* be used in production since it does not check for error
return from file:write() or file:close(). Try this:
See also: http://lua-users.org/lists/lua-l/2011-03/msg00290.html
This is precisely why exceptions were created, because most (i.e. nearly
all) programmers do not properly handle errors when they are mixed into the
data channel of the return-value. It was always a favorite parlor game of
mine, when I encounter a C programmer who insists that he checks for errors
in the return-value of _every_ function call that he makes, to show me all
of his printf()s and fprintf()s. I've not lost that bet yet.