Delivered-To: garrigue at math.nagoya-u.ac.jp Authentication-Results: mailhost.math.nagoya-u.ac.jp sender=lablgtk-bounces at yquem.inria.fr; domainkey=neutral (no query protocol specified; no policy for yquem.inria.fr) Delivered-To: lablgtk at yquem.inria.fr DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=5LiThYf8Y8zXwIZb13B22yIGBDTIkrisqinIZ65ow4M=; b=B/WSRJRrf9fwDqfzZccaeSlYJ+vRWWTBbWg4tvnGXINSr2ErG5hDiz3IMhtl/DqKr4 bLfqP9gypSvW860CkDwW3wVybgmmKQbqG5HYnbbWxiLBJV+F+0UMkuyUG9mNVINlFp5s hsV+7zVCNo/kysHk8FnSZjjohfzEOB5anFVmY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=SejCQvVa1XoKuic6Mqz4zzRc1Vooj88fOKYSh2IHv2KhfuGH5W9Oc8W53gGDBQsEoq 9T3/KW1S663gdT07CLg96inLL/mlMdjTLXV/KuGORPHkrsc2dfkx58MUQ9TbfkVnBpzo KkrnX4+8pJCjXufRITwg4N+JQJQaHmuf+7cO4= Message-ID: <4942FE09.1040508 at gmail.com> Date: Fri, 12 Dec 2008 18:12:57 -0600 From: Edgar Friendly MIME-Version: 1.0 To: Mike Spivey Subject: Re: [Lablgtk] Binding for gtkSourceView-2.0 References: <4940ED23.9010808 at comlab.ox.ac.uk> <49410E1F.1080203 at cea.fr> <49411B69.7080600@comlab.ox.ac.uk> In-Reply-To: <49411B69.7080600 at comlab.ox.ac.uk> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Benjamin Monate , lablgtk at yquem.inria.fr Mike Spivey wrote: > (1) Is there a fixed rule for what methods take () as a final parameter? > Methods with side effects and no arguments, yes; but what about methods > like > > method guess_language : > ?filename:string -> ?content_type:string > -> unit -> source_language (* or raise Not_found *) > > that have no side-effects and only optional arguments? > Yes on methods with only optional parameters. Unless there's a non-optional parameter, uses without arguments could be partial. General rule: use () as final parameter when necessary - when you need to be able to force non-partial application. > (2) On the same example: if a C method with type t may return NULL, then > we have multiple possibilities in OCaml: > > (i) return "t option" > (ii) return "t", but raise Not_found if the result is NULL > (iii) if t = string, then return the empty string for NULL > > A similar question applies to arguments that may be NULL. Is there a > rule that I should follow? > Depends on whether returning NULL is really exceptional, but probably not (iii), unless the empty string really is meant by a NULL response. E. _______________________________________________ Lablgtk mailing list Lablgtk@yquem.inria.fr http://yquem.inria.fr/cgi-bin/mailman/listinfo/lablgtk