We need type annotations.. -------------------------- Key: LS-617 URL: http://dev.sourcefabric.org/browse/LS-617 Project: Liquidsoap Issue Type: New Feature Affects Versions: 1.0 Reporter: Romain Beauxis Priority: Blocker
Here's why: # def apply(f, x) = f(x=x) end;; apply : (((x:'a)->'b),'a)->'b = <fun> # def optional(~x="f") = "f" end;; optional : (?x:string)->string = fun (~x="f") -> "f" # apply(optional, "foo");; At line 316, char -125: this value has type (?x:_)->_ (infered at line 316, char -139--110) but it should be a subtype of (the type of the v In OCaml: # let apply f x = f ~x:x ;; val apply : (x:'a -> 'b) -> 'a -> 'b = <fun> # let optional ?(x="foo") = x;; Warning 16: this optional argument cannot be erased. val optional : ?x:string -> string = <fun> # apply optional "gni";; Error: This expression has type ?x:string -> string but an expression was expected of type x:'a -> 'b BUT: # let apply (f : ?x:'a -> 'b) x = f ~x:x ;; val apply : (?x:'a -> 'b) -> 'a -> 'b = <fun> # apply optional "gni";; - : string = "gni" In case you're wondering, I have a much more useful example that cannot work without that... -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://dev.sourcefabric.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira ------------------------------------------------------------------------------ For Developers, A Lot Can Happen In A Second. Boundary is the first to Know...and Tell You. Monitor Your Applications in Ultra-Fine Resolution. Try it FREE! http://p.sf.net/sfu/Boundary-d2dvs2 _______________________________________________ Savonet-devl mailing list Savonet-devl@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/savonet-devl