Re: [Vala] returning async func from a callback



On Tue, 2015-01-27 at 04:10 +0800, MohanR wrote:
On Mon, 2015-01-26 at 11:43 -0800, Mario Daniel Ruiz Saavedra wrote:
What about setting the Cancellable as a default null parameter?
Something like:

public async book init(string[] args, Cancellable? cancellable = null)

yes, cancellable will work perfectly as long as the caller catches the
error. I'm trying to find out any way to make sure the caller get
notified even if the caller don't pass a cancellable object and not
catching the errors.

Why not just have the init function throw an exception?  A
GLib.IOError.CANCELLED would make senseā€¦  If the consumer is written in
Vala they'll get a warning at compile time about forgetting to catch an
error, and an error at runtime if it gets thrown.


-Evan



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