Re: [Caml-list] GADT constructor syntax

2010-12-05 Thread Jacques Garrigue
hat is should either unify 'a and 'b, being in practice equivalent to "type 'a t = Foo of 'a", or flag an error because 'a is not available in this branch. I might actually prefer the unification approach, because this conforms to the intuition that the scope

Re: [Caml-list] lablgtk pango_parse_markup

2010-11-29 Thread Jacques Garrigue
kup:"Hello" () Jacques Garrigue On 2010/11/29, at 22:20, Daniel de Rauglaudre wrote: > Hi, > > I'd like to have a "label" widget in Lablgtk with a string with > internationalization, bold, italic, utf8, color, things like that. > > I am not su

Re: [Caml-list] Desktop GUI toolkits - current state of the art?

2010-11-23 Thread Jacques Garrigue
lumsy). The obvious alternative to lablgtk2 is of course labltk. I personally think that labltk is still the easiest way to build a GUI, but many do not like Tk's look&feel. I'm not aware of other GUI toolkits for ocaml, but I think there are also web-based UIs. Jacques Garrigue O

Re: [Caml-list] Option functions (or lack thereof) + operator for composition

2010-11-16 Thread Jacques Garrigue
point of view, since you can use it in place of parentheses to sequence multiple arguments) If you want the compositionality, you can use something starting with @: # let (@@) f x = f x;; val ( @@ ) : ('a -> 'b) -> 'a -> 'b = # succ @@ succ @@ succ 3;; - : int = 6

Re: [Caml-list] Merging object signatures

2010-11-05 Thread Jacques Garrigue
inherit bar_t end val do_something : #foobar_t -> bool I agree that this is rather verbose. I thought a few times of adding the syntax you propose, but was always stopped by the fact you can already do it in a verbose way. Jacques Garrigue ___ Caml-l

Re: [Caml-list] Re: Generalized Algebraic Datatypes

2010-10-29 Thread Jacques Garrigue
t * 'a t : 'b t seems OK too. Actually this would have the advantage of allowing the scope of existential variables to be explicit. I.e. one could write App of 'a. ('a -> 'b) t * 'a t : 'b t Jacques Garrigue ___ Cam

Re: [Caml-list] When can we ignore CAMLparam and CAMLreturn?

2010-10-25 Thread Jacques Garrigue
ricvalue_val's, Args need not be protected. Similarly for the result, we are just returning the result of another function, with no risk of corruption. When in doubt, it is always safer to use CAMLparam/CAMLreturn, eventhough they will generate a bit more code. Jacques Garrigue ___

Re: [Caml-list] Type constraint to explain that a polymorphic variants is included into another

2010-10-08 Thread Jacques Garrigue
On 2010/10/09, at 2:13, Sylvain Le Gall wrote: > Hello all, > > I would like to build an interface for plugins that allow to extract at the > same time a very specific data for a plugin family and to extract > general help for plugins. > > Here is an example: [...] > This code doesn't compile

RE: [Caml-list] LablGTK for ocaml 3.12

2010-10-01 Thread Jacques Garrigue
You were looking in the wrong place. The official lablgtk distribution is at wwwfun.kurims.kyoto-u.ac.jp/soft/olabl/lablgtk.html Since 2.14.2 as just been released, and there has been no change in the trunk since then, the daily snapshots are also ok. Jacques - From: Jianzhou Zhao Hi, I

Re: [Caml-list] Optional arguments "between" non-optional ones

2010-09-23 Thread Jacques Garrigue
rse we are very careful of not breaking the formal semantics (where there is no eta-expansion, and discarding will only occur when the function is applied). Whenever the eta-expansion approach might introduce a discrepancy, you will get a type error. Jacques Garrigue __

Re: [Caml-list] difference of [< `A of & int] and [< `A of int] ?

2010-09-21 Thread Jacques Garrigue
e. When checking types against an interface, such conjunctive types are not allowed. So the type checker attemps to unify all possibilities, but since no argument is not unifiable with anything else, it fails. Unfortunately, the error message is not very explicit about the cause. J

RE: [Caml-list] LablGtk 2.14.2

2010-09-17 Thread Jacques Garrigue
Thanks for the report. This is fixed now. Jacques Garrigue - From: JérémieDimino The link to download the tarball seems to be broken: it ends with lablgtk-2.14.2.gz instead of lablgtk-2.14.2.tar.gz On Fri, Sep 17, 2010 at 05:59:19PM +0900, Jacques Garrigue wrote: > Dear Caml

[Caml-list] LablGtk 2.14.2

2010-09-17 Thread Jacques Garrigue
, gtksourceview2.) You can find it at: http://wwwfun.kurims.kyoto-u.ac.jp/soft/olabl/lablgtk.html The windows release will have to wait for a windows version of ocaml 3.12... --- Jacques Garrigue Nagoya University

Re: [Caml-list] functor substitution gives error

2010-09-07 Thread Jacques Garrigue
r option, -no-app-funct, which disables applicative functors, and as a result allows strengthening in more cases. This solves your problem, but not Hendrik's, because his example requires applicative functor to start with. Jacques Garrigue [Your 2 other versions] > > module A :

Re: [Caml-list] functor substitution gives error

2010-09-07 Thread Jacques Garrigue
uilt assuming that there no anonymous modules. The solution is easy enough: name all modules. Here you just have to write: module Unit = struct end module C(FreshGram : functor(Unit : sig end) -> Camlp4Syntax) : Camlp4Syntax = Printers_Ocaml_Make(FreshGram(Unit)) Hope this helps. Jacqu

Re: [Caml-list] Bug in the module system of version 3.12.0+beta1

2010-07-22 Thread Jacques Garrigue
On 2010/07/22, at 18:37, rossb...@mpi-sws.org wrote: > "Jacques Garrigue" wrote: >> >> module type MyModuleType(Param:ParamType) = sig ... end >> >> But this just doesn't make sense. > > Hm, I would disagree. It makes perfect sense, it just

Re: [Caml-list] Bug in the module system of version 3.12.0+beta1

2010-07-21 Thread Jacques Garrigue
new solution in 3.12 is to use a variant of the "with" construct, which does exactly what you want, i.e. it turns a signature into a "function" returning a signature. Hope this helps, Jacques Garrigue ___ Caml-list ma

Re: [Caml-list] Converting variants with only constant constructors to integers

2010-06-08 Thread Jacques Garrigue
From: Kaustuv Chaudhuri > On Tue, Jun 8, 2010 at 4:37 PM, Jacques Garrigue > wrote: >> Of course intify can cause a segmentation fault! >> >> # let arr = Array.of_list [intify 1.0; 0];; >> Segmentation fault > > This may be splitting hairs, but the reason tha

Re: [Caml-list] Converting variants with only constant constructors to integers

2010-06-08 Thread Jacques Garrigue
representations... Jacques Garrigue On Tue, Jun 8, 2010 at 8:40 PM, bluestorm wrote: > You're right : that's true in the "int" case and I hadn't considered it. > But if you use the same trick for ('a -> float) or other types you can get a > segfault : > #

Re: [Caml-list] Annotated trees

2010-06-06 Thread Jacques Garrigue
thout pattern-matching. But I know that many people are happy with the other aproach, so I'm not sure that it matters that much. Jacques Garrigue ___ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/mailman/listinf

Re: [Caml-list] Questions concerning modules as first-class values

2010-06-03 Thread Jacques Garrigue
ethod to encoding existential types in CPS style, but this is going to be costly and not very natural.) Jacques Garrigue ___ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml

Re: [Caml-list] new emacs tuareg mode release

2010-05-26 Thread Jacques Garrigue
t tuareg mode was more stable. I'm not going to suggest that tuareg mode switch to the ocaml-mode code base, because I think that actually the tuareg code is cleaner. However, for various historical reasons the two code bases are developped in parallel, with some reasonable amount of sharing,

[Caml-list] [Lablgtk] LablGtk 2.14.1

2010-05-20 Thread Jacques Garrigue
The windows release has not been updated at this time. --- Jacques Garrigue Nagoya University garrigue at math.nagoya-u.ac.jp http://www.math.nagoya-u.ac.jp/~garrigue/>

Re: [Caml-list] Problem with recursive class and non-class types

2010-05-20 Thread Jacques Garrigue
: sig type foo = { bar : M.bar; } class type bar = object val mutable foo : foo list end end = M class bar : M.bar = object val mutable foo : M.foo list = [] end You still need to provide an explicit interface for bar. Hope this helps, Jacques Garrigue ___

Re: [Caml-list] Binding and evaluation order in module/type/value languages

2010-05-17 Thread Jacques Garrigue
gt; let r3 = r ts > > let test12 = assert (r1 = r2) (* fail => r1 ≠ r2 *) > let test13 = assert (r1 = r3) (* fail => r1 ≠ r3 *) > > (* Conclusion: RHS evaluated exactly at the point of mapping application *) Sure, this is an eager language. Jacques Garrigue _

Re: [Caml-list] Closed variants, type constraints and module signature

2010-05-17 Thread Jacques Garrigue
hiding something. This is not the same thing as type abbreviations, because constraints are applied from the outside, while abbreviations just have to be expanded. Jacques Garrigue ___ Caml-list mailing list. Subscription management: http://yq

Re: [Caml-list] Closed variants, type constraints and module signature

2010-05-14 Thread Jacques Garrigue
From: Philippe Veber > 2010/5/14 Jacques Garrigue > >> From: Philippe Veber >> >> > I'd like to define a type with a variable that is constrained to accept >> only >> > polymorphic variant types included in a given set of tags. That is how I >

Re: [Caml-list] Closed variants, type constraints and module signature

2010-05-14 Thread Jacques Garrigue
But it doesn't really work! More precisely, the type [< `a | `b > `a ] t is an instance of 'a t, not 'a t itself, an a module interface should give a type at most as general as the implementation. In your case, you should simply write type t = [`a | `b] since you don

Re: [Caml-list] Module type of a structure returned by functor

2010-04-26 Thread Jacques Garrigue
entEdge (SmallX) (* Build the result signature by instantiating Edge signature *) module type EdgeX = Edge with type t := SmallX.t (* Alternative approach, obtain the same signature from EdgeX itself *) module type EdgeX' = module type of EdgeX module Algorithm(EdgeX : EdgeX) = struct let d

Re: [Caml-list] Functions over polymorphic variants

2010-03-22 Thread Jacques Garrigue
amples, but you cannot build polymorphic combinators. Note. In designing a type system where you would be able to express such "differential" types, poinder the problem: what is the type of transform composed with itself. Jacques Garrigue

Re: [Caml-list] range of hash function

2010-02-20 Thread Jacques Garrigue
ifferent. The range is 31-bits rather than 30-bits, and the factor is 243, so that names of no more than 4 characters are guaranteed to be different. You still have collisions, but they are going to be less similar. Both hash functions are defined in byterun/hash.c. Hope this helps, Jacques Garrig

Re: [Caml-list] Preventing values from escaping a context

2010-02-09 Thread Jacques Garrigue
s not work in ocaml. So ocaml also could profit from uniqueness types. Cheers, Jacques Garrigue ___ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.inria.fr Beginner'

Re: [Caml-list] Preventing values from escaping a context

2010-02-08 Thread Jacques Garrigue
ref (fun () -> ()) let f ctx = r := (fun () -> chgCtx ctx) (* later on *) List.hd !r () The language is just too expressive... You should rather look into adding a dynamic flag to your context, causing a runtime error if you use it later. Jacques Garrigue __

Re: [Caml-list] Error: In the definition of t, type ('a, 'b) t should be ('b, 'a) t

2010-01-05 Thread Jacques Garrigue
ally want to define this type, you have to unroll it by hand: type ('a, 'b) t = [ `A of 'a | `T of [ `A of 'b | `T of ('a,'b) t]];; (I added an argument to `A to make the parameters meaningful.) Jacques Garrigue ___ Caml-

Re: [Caml-list] revised syntax for abstract types ?

2009-12-10 Thread Jacques Garrigue
map f t) end module IntList = struct type elt = int type list = Nil | Cons of elt * list end module IntM = F(IntList);; IntM.map succ (IntList.Cons (1, IntList.Nil));; Again, these two definitions of list, while representing the same data, are incompatible. Hope this helps. Jacques Garrigue

Re: [Caml-list] Constructors are not functions

2009-10-06 Thread Jacques Garrigue
able before transforming it, then it would not be theoretically impossible to have campl4 read the dumped types and use them for an extra pass. You would still need to type everything once more after that for safety. Jacques Garrigue ___ Caml-list

[Caml-list] LablGtk 2.14.0

2009-09-25 Thread Jacques Garrigue
. --- Jacques Garrigue Nagoya University garrigue at math.nagoya-u.ac.jp http://www.math.nagoya-u.ac.jp/~garrigue/>JG ___ Caml-list mailing list. Subscription management: h

Re: [Caml-list] OC4MC : OCaml for Multicore architectures

2009-09-24 Thread Jacques Garrigue
First, like everybody else, I'd like very much to try this out. Is there any chance it could compile on Snow Leopard :-) (I suppose it's near impossible, but still ask...) From: Jon Harrop > Visual Basic has been a *lot* faster than OCaml for several years now, not > least because it makes effic

Re: [Caml-list] polymorphic method.

2009-09-11 Thread Jacques Garrigue
x27;m not sure it will help beginners * adding yet another keyword is not that great... So if find time with nothing else to do I might try with a prototype, but don't hold your breath. At times I even think that all class definitions should be accompanied by a class interface, with explici

Re: [Caml-list] polymorphic method.

2009-09-10 Thread Jacques Garrigue
ll as a language feature. Particularly when you think that future versions of the compiler may be able to infer more polymorphic types, thanks to improvements in type inference, and suddenly break your program. Jacques Garrigue ___ Caml-list mailing lis

Re: [Caml-list] polymorphic method.

2009-09-10 Thread Jacques Garrigue
method type contains also class parameters: class ['a] cell (x : 'a) = object method pair : 'b. 'b -> 'a * 'b = fun y -> (x,y) end More generally, you might end up with types more polymorphic than you expected, and since differently instantiated polymorphic method

Re: [Caml-list] ocamlgraph predecessors

2009-08-09 Thread Jacques Garrigue
track of them independently of the value itself. Since linux has no GC, using doubly linked lists has only a very limited cost, mostly related to the extra space needed. By the way, BSD uses lots of singly-linked lists, probably because it comes fro

Re: [Caml-list] annotations and type-checking

2009-07-29 Thread Jacques Garrigue
les even syntactically legal in annotations? If backwards > compatibility is the issue, could it not at the very very least give a > compiler warning when they are used? Because it is useful to be able to have type annotations sharing type variables in different places in a term (for instance for di

Re: [Caml-list] Width subtyping

2009-05-31 Thread Jacques Garrigue
both are much worse than real records. But whether it matters or not depends much on what you use them for in your program. Jacques Garrigue (* To compile: ocamlc -I +camlp4 -c -pp camlp4orf pa_polymap.ml ocamlc -c polymap.ml To use: ocaml dynlink.cma camlp4o.c

Re: [Caml-list] let x = ... in object ...

2009-05-26 Thread Jacques Garrigue
;; After the gc, x is collected. What you are seeing is the size taken by y. Jacques Garrigue ___ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.inria.fr Beginner'

Re: [Caml-list] Static Function in Class

2009-05-17 Thread Jacques Garrigue
est = private < print : unit; .. > val create : int -> test val equal : test -> test -> bool end = struct class test (n : int) = object val x = n method get_x = x method print = print_int x end let create = new test let equal t1 t2 = t1#get_x = t

Re: [Caml-list] Interpretation of an error message "type ('a, 'b) t should be ('a, 'c) t" in a signature?

2009-04-20 Thread Jacques Garrigue
rences of batch) All occurences of batch inside its own definition should have the same parameters ('a,'b), but here both have different parameters. I admit that the error message is a bit confusing because all parameters are variables, and their names are not preserved by the type-chec

Re: [Caml-list] mixed functional / object style

2009-04-19 Thread Jacques Garrigue
method x = x method t = t end The above class has just two implicit fields, x and t. Jacques Garrigue ___ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.inria.fr Be

Re: [Caml-list] pattern matching and records vs tuples

2009-04-16 Thread Jacques Garrigue
ent of the OCaml get_x you propose. You can do this with SML# http://www.pllab.riec.tohoku.ac.jp/smlsharp/ # fun f x = #name x; val f = fn : ['a, 'b#{name:'a}. 'b -> 'a] # f {name = "Joe", age = 21}; val it = "Joe" : string But the compiler is rather clever... Jac

Re: [Caml-list] Typing of polymorphic variants

2009-04-16 Thread Jacques Garrigue
regular types in type abbreviations. It only applies when the definitions are mutually recursive, and do not go through any datatype definition. Jacques Garrigue ___ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/m

Re: [Caml-list] class type param constraint

2009-04-09 Thread Jacques Garrigue
From: Radzevich Belevich > class [ 'c ] a = > object(self) > constraint 'c = < .. > > method as_c = (self :> 'c) > method id = Oo.id self > end ;; > class ['a] a : > object ('a) > constraint 'a = < as_c : 'a; id : int; .. > > method as_c : 'a

Re: [Caml-list] Subtyping

2009-04-07 Thread Jacques Garrigue
g you cannot abbreviate is the {bop = ...} part, as this is where universality is checked, to ensure that no cross application can be done. Jacques Garrigue > Then what you are asking for is existential types. There is no syntax > for them in ocaml, but they can be encoded through universal typ

Re: [Caml-list] Subtyping

2009-04-07 Thread Jacques Garrigue
x27;b base_op -> 'b} let l = let a = {x = 1; fn = print_int} and b = {x = 1.2; fn = print_float} in [{base = fun x -> x.bop a}; {base = fun x -> x.bop b}] List.iter (fun w -> w.base {bop = fun r -> r.fn r.x}) l As you can see, the result is rather verbose, but this wor

Re: [Caml-list] Execution order in class construction

2009-04-05 Thread Jacques Garrigue
tializers too. The current implementation keeps the definition order, and I don't see why it should change, but if your code depends on such things it may always be a good idea to put somewhere a bit of code that verifies that the behaviour is correct. Jacques Garrigue

Re: [Caml-list] Bug? Constraints get ignored in methods

2009-04-05 Thread Jacques Garrigue
y, the self coercion and the use of a non-abbreviated object type are independent, but in general it is too heavy to use the second without the first. Jacques Garrigue ___ Caml-list mailing list. Subscription management: http://yquem.i

Re: [Caml-list] Instance variables can't be polymorphic?

2009-04-05 Thread Jacques Garrigue
tions this way: as > instance variable and accessible through inheritance, is there any > workaround or suggestions ? The simplest way I see currently is to use a let defined field (i.e., before the object keyword, but then you can't access it aft

Re: [Caml-list] A small question on polymorphic variants

2009-04-05 Thread Jacques Garrigue
] | Cp of tp] as 'b) > where ['b/'a] represents substitution. In other words, b has one more > constructor than a. Is a always a subtype of b? Yes, but only if 'a appears only in covariant positions inside t1...tn. And you will need "double coercions" (i.e. coercions

Re: [Caml-list] Bug? Constraints get ignored in methods

2009-04-02 Thread Jacques GARRIGUE
rtual base_type = object (self) val mutable virtual next : base_type option method virtual set_next_base : base_type option -> unit method as_base = (self :> base_type) method set_next : 'a. as 'a -> unit = fun x -> self#set_next_base x#as_base end T

Re: [Caml-list] typing problem with sexplib and mutually recursive polymorphic types

2009-03-11 Thread Jacques Garrigue
few years ago. The idea was to provide a basis for implementing GADTs. But since the GADT work was not finished, it was never merged in the main trunk. So it would be very easy to have polymorphic recursion in ocaml. The real question is whether it is that useful in the absence of GADTs, knowing t

Re: [Caml-list] Unusual type declaration and Sexplib

2009-02-23 Thread Jacques Garrigue
= struct type 'a foobar_t = [ `Foo of int | `Bar of 'a list ] type t = t foobar_t let foo x = `Foo x let bar x = `Bar x end Jacques Garrigue > module M: > sig > type 'a foobar_t = > [ `Foo of int >

Re: [Caml-list] Private types in 3.11, again

2009-01-21 Thread Jacques Garrigue
ef of string * 'a t list" in the definition, rather than "Mref of string * [`Nonlink] t list" like I did. But being more specific also means that you have more information when you unwrap an Mref node. Cheers, Jacques Garrigue _

Re: [Caml-list] Private types in 3.11, again

2009-01-21 Thread Jacques Garrigue
to do it inside Node, and you keep full generality (i.e. your make may choose to only recurse on Bold for instance...) I hope this gives you some ideas on how to proceed. Cheers, Jacques Garrigue module Node: sig type +'a t = private | Text of string | Bold of 'a t list |

Re: [Caml-list] Private types in 3.11, again

2009-01-21 Thread Jacques Garrigue
From: Dario Teixeira > I ditched the regular variants in favour of polymorphic variants, hoping > the coercion trick described by Jacques Garrigue would help [1]. I've also > simplified the formulation as much as possible. Anyway, I'm still stuck > with the same problem:

Re: [Caml-list] Private types in 3.11, again

2009-01-21 Thread Jacques Garrigue
[That point to the seq in List.map sprintf2 seq]. Here is where the > potential bug is: how is string incompatible with string? > [If this is a bug, I'll add it to the database] The bug is in only in the error message; which seems another instance of the problem you reported in your p

Re: [Caml-list] What is a future of ocaml?

2009-01-15 Thread Jacques Garrigue
stance, it is not completely clear how one could select instances of type classes for polymorphic variants, without introducing conflicts. I'm afraid the combination of type classes with modules and functors is not trivial either. Jacques Garrigue

Re: [Caml-list] Debugging the compiler

2009-01-03 Thread Jacques GARRIGUE
From: Jacques Carette Subject: [Caml-list] Debugging the compiler Date: Sat, 27 Dec 2008 10:24:52 -0500 > Nothing like the holidays for a little playing around with some ideas by > modifying a compiler... Having got the hang of bootstrapping the > compiler [with help from old caml-list posting

Re: [Caml-list] How to handle try .... finally properly?

2008-12-10 Thread Jacques GARRIGUE
Note that this will not work properly if partial applications of f cause side-effects (i.e. f is actually "fun x -> ...; fun y -> ..."). This is pretty rare, but I believe this is the case for printf for instance. Jacques Garrigue _

Re: [Caml-list] Private types

2008-11-01 Thread Jacques Garrigue
int > and float differs, a coercion function isn't required. The internal > representation of [private int] and [int] is the same, not to mention > one is exactly the [private] of the other. This was not intended as a complete comparison :-) However, since the coercion function is

Re: [Caml-list] Private types

2008-11-01 Thread Jacques Garrigue
pture it with 'a), you would have to recover it by hand. Jacques Garrigue > I have also been playing with 3.11's private types, and I would like to > share a problem I've come across. Suppose I have a Foobar module defined > as follows (note the use of a type constraint): >

Re: [Caml-list] Private types

2008-10-30 Thread Jacques Garrigue
er ocaml separates the two, and requires coercion functions whenever you want to use an int as a float. Cheers, Jacques Garrigue ___ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://cam

Re: [Caml-list] What does Jane Street use/want for an IDE? What about you?

2008-10-25 Thread Jacques Garrigue
Using labels makes this kind of code more readable. open StdLabels let x = List.map my_list ~f: begin fun z -> very_blabla end in ... Jacques Garrigue From: DooMeeR <[EMAIL PROTECTED]> > Another possibility is: > > let x = List.map begin fun z ->

[Caml-list] Re: A bug(?) around phantoms in 3.11.0 b1

2008-10-21 Thread Jacques Garrigue
Hi Jun, If it's a bug, it should go to mantis... but it's not one. From: "Jun Furuse" <[EMAIL PROTECTED]> > I found a strange bug in 3.11.0 beta 1. The following typical example > of phantom types does not compile any more. (It is compilable in > 3.10.2, but not in release311): > > module M : si

Re: [Caml-list] ocaml 3.11 and lablgtk2

2008-10-17 Thread Jacques Garrigue
g 7.1-BETA1. Even unison works fine. Note however that since 7.0 linking lablgtk programs under FreeBSD is very slow (1mn). I know how to fix it in the ocaml compiler, but this rather looks like a FreeBSD bug. Cheers, Jacques Garrigue ___ Caml-list mai

Re: [Caml-list] Ocaml type with constraints?

2008-09-21 Thread Jacques Garrigue
ate to create an item, but you can use pattern-matching as usual to access its contents. Jacques Garrigue ___ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.inria.fr Be

Re: [Caml-list] Recursive parametrized classes bug?

2008-09-18 Thread Jacques Garrigue
rized class type inside a recursive definition introduces constraints on parameters. The classical workaround is to break the recursion (when needed) by adding more parameters. Another trick is to use recursive modules, but this is actually more verbose, and

Re: [Caml-list] typeclasses in OCaml

2008-08-22 Thread Jacques Garrigue
our object type (which you need here, since you want to write #mappable), there are other difficulties related to recursive types having to be regular. A classical workaround is to define map as a function using #fold and cons: let map cons f (o : 'a #foldable) = o#fold (fun x o' ->

Re: [Caml-list] Not a variant??

2008-08-21 Thread Jacques Garrigue
From: Jacques Carette <[EMAIL PROTECTED]> > Jacques Garrigue wrote: > > The message is maybe not clear enough: for pattern-matching and > > inheritance, you need an "exact" variant type, i.e. a type whose lower > > and upper bounds are identical. > Indeed

Re: [Caml-list] Not a variant??

2008-08-19 Thread Jacques Garrigue
7;a = [< a | b] > ;; The message is maybe not clear enough: for pattern-matching and inheritance, you need an "exact" variant type, i.e. a type whose lower and upper bounds are identical. This is clearly not the case for c. The standard workar

Re: [Caml-list] Troublesome nodes

2008-07-18 Thread Jacques Garrigue
er-engineered. You shouldn't need all that many constraints. I you could find a way to use private rows rather than private abbreviations, your code might be much simpler. But I'm sorry I couldn't follow the whole discussion on your problem. I you could summarize it shortly, with the ba

Re: [Caml-list] Troublesome nodes

2008-07-18 Thread Jacques Garrigue
From: Jacques Garrigue <[EMAIL PROTECTED]> > This is now fixed. I just hope this does not break anything... > It should be ok, but please report any new non-termination problem > immediately :-) OK, my first solution was not correct, and caused infinite loops with type t = an

Re: [Caml-list] Troublesome nodes

2008-07-18 Thread Jacques Garrigue
e ok, but please report any new non-termination problem immediately :-) Cheers, Jacques Garrigue ___ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.inria.fr Beginner&#x

Re: [Caml-list] Troublesome nodes

2008-07-18 Thread Jacques Garrigue
gt; int) - 1) : int :> Nat.t);; (* fails *) I think I know the reason, which is probably related to the way abbreviation expansions are cached, but this needs more investigating. Jacques Garrigue ___ Caml-list mailing list. Subscription management:

Re: [Caml-list] Troublesome nodes

2008-07-17 Thread Jacques Garrigue
From: Jeremy Yallop <[EMAIL PROTECTED]> > Jacques Garrigue wrote: > > From: Jeremy Yallop <[EMAIL PROTECTED]> > >> Dario Teixeira wrote: > >>> type ('a, 'b) t = private 'a constraint 'a = [< super_node_t ] > >> I don

Re: [Caml-list] Troublesome nodes

2008-07-17 Thread Jacques Garrigue
inction between private rows and private abbreviations is syntactic. In particular type (+'a, 'b) t = private 'a constraint 'a = [< super_node_t ] defined a private row in 3.10, but it is a private abbreviation in 3.11 (with of course a different semantics). If you need the pri

Re: [Caml-list] Troublesome nodes

2008-07-16 Thread Jacques Garrigue
problem is that phantom types must be implemented in terms > of abstract (or at least generative) types. This is actually the other way round: abstract and private types allow phantom types, but abbreviations and normal datatypes (generative ones) don

Re: [Caml-list] Why can't immediate objects be extended?

2008-07-15 Thread Jacques Garrigue
uires a very complicated type system (look at Didier Remy's papers) Also, if you want lots of fields, this may be a good idea to use a constraint to name parameters. type +'a parent_data = {str: 'str; cmt: 'cmt} constraint 'a = The ex

Re: [Caml-list] Polymorphic variant as a witness?

2008-06-26 Thread Jacques Garrigue
e realized that the above code just uses functions to do that same thing as functors. Functors would be syntactically nicer, but they wouldn't let you infer the type of w, which is the whole point. If getting data out of tuples proves to be a pain, you could also return an immediate object. Chee

Re: [Caml-list] Problem with class method and polymorphic variants

2008-06-25 Thread Jacques Garrigue
re.ml. As to why the name of the method matters, it may be related to the order in which the checking is done. Since types are graphs, this ends up being relevant (but only when there is a bug!) Jacques Garrigue ___ Caml-list mailing list. S

Re: [Caml-list] Problem with class method and polymorphic variants

2008-06-24 Thread Jacques Garrigue
o the bug tracker. By the way you could also trigger it in the toplevel by giving explicitly a module signature (this is what ocamlc does internally). This is now fixed in CVS, branch release310. Note that you may still have other kinds of problems using upper-bounded polymorpic variants inside co

Re: [Caml-list] Polymorphic variant as a witness?

2008-06-23 Thread Jacques Garrigue
with non-generalizable types, as it does not generate any .cmi. * if you want to be still able to compile, you can write a .mli file not including the witness. ocamlc -i on the .ml will still show you the witness. * other solution: put everything inside a function, so that the type variab

Re: [Caml-list] Type checker (ex-)bug

2008-06-18 Thread Jacques Garrigue
checks changing type levels, and losing polymorphism. In you specific case, this is the delayed check about sequences (here you should have a warning if x has a concrete type other than unit). So yes, this is the fix you need to avoid the above problem, and other loss of polymorphism related to

Re: [Caml-list] picking / marshaling to strings in ocaml-revision-stable way

2008-05-31 Thread Jacques Garrigue
d be sufficient for your needs. It is however sensitive to the data format you use (the types for your data), and there is currently no way to verify that the type has not changed between two versions of a program. -----

Re: [Caml-list] ocamlc freezes

2008-05-12 Thread Jacques Garrigue
code. Anyway, this is the first line that matters. You cannot change a method's type with method override. So get_right_sibling in typ has still type [node option], which means that in foo_typ, ['p foo_typ] should be a [node option], hence the contradiction. There was a type-checker bug

Re: [Caml-list] Invoking the standard library ?

2008-04-29 Thread Jacques Garrigue
e "open StdLabels" there is no way to access the original List module (except if you've first defined an alias for it with a different name). It has been discussed at times that putting the standard library in a packed module would alleviate t