[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: data, err = f() idiom
- From: Jorge <xxopxe@...>
- Date: Thu, 19 Jan 2012 11:07:01 -0200
Hi everyone,
When writing:
local data, err = f()
what is the error condition, data being nil, or err being not nil?
Is returning data AND a error frowned upon? Example: your f() is
instructed to return data in chunks of N bytes. But when the last chunk
is being read, the connection (socket, whatever) closes and f has less
than N bytes. An API that returns "incompletedata, 'closed'" is well
regarded?
Jorge