gim has quit [Read error: 110 (Connection timed out)]
gim has joined #ocaml
Smerdyakov has joined #ocaml
zzorn is now known as zzorn_sleep
zzorn_sleep has quit ["They are coming to take me away, ha ha"]
cjohnson has joined #ocaml
reltuk has quit []
Sonarman has joined #ocaml
cjohnson has quit ["Leaving"]
vezenchio has quit ["I live in a yurt on the steppes of Sheepfuckistan. That's why."]
Snark has joined #ocaml
Submarine has joined #ocaml
Ultima-Water has joined #ocaml
Ultima-Water has left #ocaml []
Boojum has joined #ocaml
Snark has quit [Read error: 110 (Connection timed out)]
como has joined #ocaml
Boojum is now known as Snark
mbh has quit ["leaving"]
Snark has quit [Read error: 60 (Operation timed out)]
Snark has joined #ocaml
Sonarman has quit ["leaving"]
smimou has joined #ocaml
como has left #ocaml []
como has joined #ocaml
cognominal has quit [Read error: 54 (Connection reset by peer)]
cognominal has joined #ocaml
Skal has joined #ocaml
tintin has joined #ocaml
zzorn has joined #ocaml
tintin has quit [Remote closed the connection]
Msandin has joined #ocaml
_JusSx_ has joined #ocaml
mrvn_ has joined #ocaml
cjohnson has joined #ocaml
mrvn has quit [Read error: 110 (Connection timed out)]
_fab has joined #ocaml
Msandin has quit [Read error: 110 (Connection timed out)]
como_ has joined #ocaml
como has quit [Read error: 110 (Connection timed out)]
vezenchio has joined #ocaml
tintin has joined #ocaml
paganini_ has joined #ocaml
paganini_ has left #ocaml []
cognominal has quit ["Leaving"]
cognominal has joined #ocaml
mrsolo has joined #ocaml
pango_ has joined #ocaml
Msandin has joined #ocaml
pango__ has quit [Read error: 104 (Connection reset by peer)]
Sonarman has joined #ocaml
cjohnson has quit ["Leaving"]
como_ is now known as como
Snark has quit ["Leaving"]
zzorn is now known as zzorn_afk
Msandin has quit [Read error: 145 (Connection timed out)]
__DL__ has quit ["Bye Bye"]
zzorn_afk has quit ["They are coming to take me away, ha ha"]
Thunfisch has joined #ocaml
<Thunfisch>
Hi there. Can anyone tell me how to compile a binary from two class files and a file with the main program? file1.ml contains class1, a virtual class which is needed by class2 in file2.ml and instantiated in main.ml. This is what I've tried:
<Thunfisch>
ocamlc -w A class1.ml class2.ml main.ml
<Thunfisch>
And this is what I received:
<Thunfisch>
File "class2.ml", line 3, characters 10-21:Unbound class
<Thunfisch>
class1
<Thunfisch>
Do I need to "include" class1 in class2 by using something like #include in C/C++?
<mellum>
you need a .mli file that describes the interface.
<mellum>
similar to a header file.
<Thunfisch>
Like ocaml -i file1.ml > file1.mli?
<Thunfisch>
ocamlc.
<mellum>
Yes, altough you'd usually want to trim it down since you don't want to expose everything.
<Thunfisch>
Hm, right.
_JusSx_ has quit ["leaving"]
<Thunfisch>
Are there any documents which describe how the ocaml batch compiler works? Something like a compiler-tutorial?
<vincenz>
You need to make sure to have them in the right order
<vincenz>
or compile separately
<Thunfisch>
Ah. Hm. I just executed ocamlc -w A file1.ml for my virtual class. But I just can't figure out what I need to do for getting file2.ml compiled. class2 in file2.ml inherits my virtual class1 from file1.ml.
<Thunfisch>
This ist kinda frustrating. I just don't get it.
<Thunfisch>
Do I have to write class1's interface into the file2.ml or is there a switch for ocamlc that includes a given interface file automatically?
<mellum>
You access it with File1.name. Then no further switch is needed.
Nutssh has quit [Read error: 104 (Connection reset by peer)]
Submarine has quit ["Leaving"]
_fab has quit [Remote closed the connection]
<vincenz>
ocamlc -c class1.ml
<vincenz>
ocamlc -c class2.ml
<vincenz>
ocamlc -o appname class1.cmo class2.cmo
<Thunfisch>
ocamlc -c class2.ml doesn't work. I get the mentioned "Unbound class" message for missing class1. mellum said that I need class1's interface. I'm still not sure, whether I need to put the interface right into class2.ml or not. My files look like this:
<Thunfisch>
class1.ml: class virtual a = object method virtual m1 : unit end;;
<Thunfisch>
class2.ml: class b = object inherit a method m1 = print_string w00t end;;
<Thunfisch>
So, I guess that class2.ml needs to "know" class1.ml somehow.
<Thunfisch>
"w00t". Or any other String.
Skal has quit [Remote closed the connection]
<vincenz>
inherity Class1.a
<vincenz>
inherit Class1.a
<vincenz>
make sure to compile class1.ml first
<vincenz>
it'll generate the .cmi or compiled ml interface file
<Thunfisch>
Perfect. It works now. Thank you, guys.
<mlh>
I dunno why i'm getting invalid_argument String_sub for the commented out line
<vincenz>
maybe there is no =
<vincenz>
oh
<vincenz>
nono
<vincenz>
the sub works like this:
<vincenz>
start len
<vincenz>
so....
<mlh>
ah!
<vincenz>
v p (lv-p)
<mlh>
i thought it was start, end.
<mlh>
ta
<mlh>
thank you! i'm too used to c++ iterators i guess
<mlh>
feel free to make any comments on my code too :-)
<vincenz>
use an iter
<vincenz>
not a for loop
<mlh>
ok. i was going to ask what the difference was between iter and map, but it looks like the difference is that map returns an array, whereas iter does not. is this correct?