<flux>
yes, ocamlgraph can be nice if you want the algorithms it has, and it's very generic too
<flux>
it can take a bit effort to start using it, though, due to its genericity :)
<flux>
and its graphviz-output doesn't do string quoting properly.. should be simple to fix, or just work around ;)
buluca has joined #ocaml
mordaunt has quit [Read error: 104 (Connection reset by peer)]
mordaunt has joined #ocaml
mrsolo has quit ["Leaving"]
ramki has quit [Remote closed the connection]
DT has joined #ocaml
seafoodX has quit [Read error: 110 (Connection timed out)]
screwt840 has quit [Read error: 104 (Connection reset by peer)]
Abo-Marwan14 has quit [Read error: 104 (Connection reset by peer)]
beterraba has quit [No route to host]
Demitar has quit ["Burn the land and boil the sea. You can't take the sky from me."]
screwt840 has joined #ocaml
kelaouchi has joined #ocaml
Abo-Marwan14 has joined #ocaml
filp has quit ["Bye"]
Demitar has joined #ocaml
kelaouch1 has quit [Read error: 110 (Connection timed out)]
ramki has joined #ocaml
CRathman has joined #ocaml
CRathman has quit [Client Quit]
kig has quit ["leaving"]
Tetsuo has quit ["Leaving"]
smimou has joined #ocaml
m3ga has joined #ocaml
m3ga has quit ["disappearing into the sunset"]
buluca has quit [Read error: 113 (No route to host)]
filp has joined #ocaml
gaja has joined #ocaml
ikaros has joined #ocaml
<DT>
Does anyone around here have experience with menhir ?
<flux>
I've used it
<flux>
for something trivial, I think, but it needed re-entrancy
<DT>
So it works ?
* DT
is just trying to decide for a parser generator.
<DT>
Let me rephrase: would you suggest using it ?
<flux>
yes
<flux>
it's more convenient
<flux>
due to its feature set
<DT>
ok
<DT>
I'm having a small problem with a 10-lines parser.
<DT>
Basically, it won't find my tokens.
<DT>
(they are defined in another module)
<DT>
Do you have any experience with that problem ?
<flux>
hmm, no..
<DT>
Well, it works when I put the tokens in the same module.
<DT>
I guess I'll start like this and look later for a way to split it.
<flux>
I actually think I've had that problem but worked around it
<flux>
perhaps by simply referring to the tokens by their fully qualified names (Module.Constructor)
<flux>
have you tried that?
<DT>
It doesn't seem to like the dot
* DT
, on the other hand, doesn't like the catch-all "syntax error" message, without a line number.
<DT>
On the other hand, it seems that I'm using a one-year old version.
* DT
now downloads and compiles a more recent version.
ikaros has quit ["segfault"]
ikaros has joined #ocaml
<flux>
about your original problem: even with ocamlyacc I've used this kind of header in the .mly: %{\nopen Plan%}
<flux>
hmph, actually didn't define the tokens in that module
<flux>
so perhaps this doesn't have anything to do with your problem :)
<DT>
Yep, I've tried that in menhir, plus the tag --external-tokens, but without success.
<DT>
Right now, the latest menhir doesn't want to compile.
<flux>
:)
ikaros has quit [Client Quit]
ita has joined #ocaml
<DT>
"Corrupted compiled interface keyword.cmi"
* DT
doesn't like that message.
<DT>
Do you know where I can download the latest ocamlfind ?
<flux>
from the ocamlfind web page I suppose.. I'm on a mobile terminal now, so I won't google for it ;)
<DT>
:)
<DT>
Turns out that the latest version is 2years old.
<flux>
maybe it just works (TM)
<flux>
which in my experience it does..
<flux>
although better documentation (or atleast more examples) would be nice
<ita>
what does ocamlfind do ?
beterraba has joined #ocaml
<DT>
flux: I assume it just works (TM) when you have only one version of OCaml on your hd.
<DT>
In my case, I have 3.09 (supplied by Ubuntu) and 3.10 (compiled by myself, yesterday).
<DT>
It has a tendency to mix both.
<DT>
Which, of course, doesn't work (TM).
<DT>
ita: it automates somewhat the task of finding the right compiler, the right packages, etc.
<DT>
Ok, with a hand-compiled version of ocamlfind, menhir does compile.
<smimou>
DT: maybe you should switch to Debian if you want a packaged cutting-edge OCaml
<DT>
I'm not going to switch to Debian just for OCaml, thanks :)
<smimou>
heh
<DT>
I do consider installing the sid packages of OCaml, but I'm a bit timid.
rwmjones has left #ocaml []
<smimou>
ah I did not see your real name DT
<smimou>
so hi btw :)
<DT>
Tiens, coucou :)
<DT>
My problem is that if I do install the Sid package, it's going to remove a hell of a lot of my non-OCaml-related packages.
<DT>
Which is something I don't really want.
<DT>
And GODI isn't 3.10 yet.
<DT>
So I'm stuck with doing everything by hand.
<smimou>
maybe you could try to build debian packages in Ubuntu so as not to mess with dependencies
<DT>
I guess I could.
<DT>
....
<DT>
Ok, now my new findlib doesn't seem able to find ulex.
<DT>
grrr...
<DT>
fixed
ita has quit ["zzzz"]
<DT>
mmmhhh....
<DT>
Parse error: entry [implem] is empty
<DT>
That used to work before I recompile findlib.
<DT>
fixed
kelaouch1 has joined #ocaml
kelaouchi has quit [Read error: 110 (Connection timed out)]
* DT
still can't get Menhir to use externally-defined tokens.
buluca has joined #ocaml
<DT>
Ok, got it.
[azoic] has joined #ocaml
Mr_Awesome has joined #ocaml
beterraba has quit [Read error: 110 (Connection timed out)]
pango has quit [Remote closed the connection]
pango has joined #ocaml
[azoic] has left #ocaml []
Demitar has quit ["Burn the land and boil the sea. You can't take the sky from me."]
CRathman has joined #ocaml
ibor has quit ["leaving"]
mrsolo has joined #ocaml
<hcarty>
DT: Godi does have 3.10 support, you just have to specify that you want it during the bootstrap process
<DT>
Oh ?
<DT>
That's good.
<DT>
I might try and install it later.
<DT>
It's just that the webpage seems to say that it's 3.09.
<hcarty>
Yes, I don't think the site has been updated, but the installer does support it
<hcarty>
Just use ./bootstrap --section 3.10 (+ whatever other options you want)
<DT>
thanks
<DT>
er... which one is semi-column ? Is it : or ; ?
* DT
might look in an English dictionary, too.
<DT>
sorry, semi-colon
<DT>
got it :)
magius_pendragon has joined #ocaml
bluestorm_ has joined #ocaml
filp has quit ["Bye"]
filp has joined #ocaml
filp has quit [Read error: 104 (Connection reset by peer)]
buluca has quit [Read error: 113 (No route to host)]
buluca has joined #ocaml
Oatschool has quit ["Leaving"]
Oatschool has joined #ocaml
mrsolo has quit ["Leaving"]
Jedai has joined #ocaml
buluca has quit [Read error: 113 (No route to host)]
Torment has quit [Read error: 110 (Connection timed out)]
loufoque has joined #ocaml
<loufoque>
how can I make a factory in Caml? I'd like to specify a type to an object or module and then generate a function that creates a variable of that type.
<loufoque>
I tried this, class ['a] factory = object method make = new 'a end;; but obviously it doesn't work
<DT>
I'm not sure I understand the question.
<DT>
Aren't factories essentially initalizers ?
<DT>
Or is it just that you want your initializer to be a method ?
<smimou>
loufoque: what would be the value of the variable?
<smimou>
you cannot have uninitialized refs in caml
<loufoque>
well, basically, instead of writing n functions that return a variable of type Ti, I want to write a generic component where I just give the type and it generates a function that does just that.
* DT
isn't sure that's possible.
<loufoque>
if you happen to know C++, I want to do template<typename T> T make() { return T(); }, then I can use make<one_type>, make<another_type> etc.
<DT>
Except it won't work if T is, say, int.
<loufoque>
I only want it to work with class types.
<DT>
What you're asking for, iirc, is meta-programming.
<loufoque>
well, I only need it to work with class types, rather
<DT>
I tend to believe that's the domain of MetaOCaml or Camlp4 rather than OCaml.
<DT>
In OCaml, you can't write a function taking an argument of type 'a and have that function work only if 'a has the "right type".
<loufoque>
let f a : 'a = a + b;; works perfectly,
<DT>
But it doesn't have type 'a -> ...
<DT>
It has type int -> int -> int .
<loufoque>
of course, because it was able to infer that only int was a valid possibility
<DT>
What you want, in practice, is not to take a class as parameter, but to take an initializer as parameter.
<DT>
Something like
<DT>
class ['a] factory (x:unit -> 'a) = object method make = x () end;;
<DT>
The difference, here, is that the C++ version you asked for performs purely syntactical transformation.
<DT>
i.e. the template may compile, but there's no guarantee that it will work if applied to any T
<DT>
in this case, you would need T to be a class with a public/friend default constructor
<DT>
in OCaml, instead of expecting the compiler to perform that check at a later stage, you rather ask for the constructor
<loufoque>
how do I use your factory?
<DT>
Let's create a useless class: class obj = object end;;
<DT>
Then
<DT>
# new factory (fun () -> new obj);;
<DT>
- : obj factory = <obj>
<DT>
or
<DT>
# let f = new factory (fun () -> new obj);;
<DT>
val f : obj factory = <obj>
<DT>
# f#make ;;
<DT>
- : obj = <obj>
<hcarty>
loufoque: Functors might do what you want as well
<DT>
That's the problem with objects: there's always another, better way around :)
<DT>
Well, unless you definitely need inheritance.
<DT>
In which case, there's always another way around, but it's not systematically better.
ita has joined #ocaml
rfischer has joined #ocaml
<loufoque>
according to the documentation, I can declare virtual values, but when I try to compile the samples, it doesn't work.
<loufoque>
is the documentation out of date?
<loufoque>
or is 3.09.2 too old?
<pango>
it's a new feature of 3.10, I think
Modius has quit [Connection timed out]
Mr_Awesome has quit [Read error: 110 (Connection timed out)]
bluestorm_ has quit [Remote closed the connection]
ygrek has joined #ocaml
jlouis_ has joined #ocaml
jlouis has quit [Read error: 110 (Connection timed out)]