<mrvn>
Now if only ocaml had polymonomorphic functions
<Drup>
wmeyer: There is a bit of problem about the way the inside of the compiler is (not) documented
<whitequark>
wmeyer: well, I have my own SSA layer which has domain knowledge of my semantics on top of LLVM
<wmeyer>
you could try reading http://compcert.inria.fr/ whitequark , i am not sure if there are papers describing exactly what a advantage to ocaml is when using the stack of intermediate languages.
<nicoo>
wmeyer: LLVM, by itself is low-level by design. Compilers for high-level languages are expected to use/provide their own IRs in between.
<whitequark>
so I guess that's the intended result
<whitequark>
or wnat nicoo said
<wmeyer>
the problem is that IR is too high level and too low level
<mrvn>
e.g. something like let (+) : type [int; float] as a . a -> a -> a = int : fun x y -> x + y | float : fun x y -> x +. y
<wmeyer>
for a backend you really need RTL
<wmeyer>
no functions
<nicoo>
mrvn: Basically, you want typeclasses ?
<wmeyer>
labels
<whitequark>
wmeyer: I think LLVM has at least two layers
<wmeyer>
MC and IR
<wmeyer>
fine
<whitequark>
yeah
<wmeyer>
still not enough
<mrvn>
nicoo: if that includes optimizing the type away then yes
<wmeyer>
the IR is too high level, for instance it assumes functions as i said before
<mrvn>
nicoo: GADTs would do it if they would get optimized away better
<nicoo>
mrvn: Sure :)
<whitequark>
wmeyer: I think I understand what you mean
<whitequark>
armcc evidently has a similar design
<whitequark>
after the frontend, it does not have function boundaries, just a giant CFG
<mrvn>
nicoo: a few functions in ocaml already are polymonomorphic. Like compare.
<whitequark>
the resulting code is both highly optimized and completely unreadable :D
<mrvn>
nicoo: but that is compiler intern
<Drup>
mrvn: compare is a hack using a C function, that's not really a generic design ...
<nicoo>
mrvn: Isn't compare actually written in C, using knowledge on OCaml's value representation ?
<nicoo>
Drup: Too fast for me, this time :)
<whitequark>
nicoo: I think you can write compare in ocaml
<whitequark>
with Obj.magic
<mrvn>
Drup: no. If the compiler can infer the type in the comparison it calls a int compare or float compare primitive directly, not the generic C function
walter has quit [Quit: This computer has gone to sleep]
<whitequark>
but then it won't work just as well with the optimizer
<wmeyer>
whitequark: I see, yes armcc is different
<nicoo>
mrvn: Yeah, but that's a case-specific optimization (though a useful one)
<whitequark>
wmeyer: yeah, I see how LLVM could benefit from that and agree with you
<nicoo>
But yes, stg like that is done by GHC with typeclasses.
<mrvn>
There are multiple compare functions, one of them works for every type, all other for special types. The compiler tries to pick a spefic one.
walter has joined #ocaml
<mrvn>
That I want expressed in the type system so any function can be declared that way
<wmeyer>
whitequark: thanks, as I said, LLVM is the best example of a compiler
<nicoo>
mrvn: So, from a semantic standpoint, you essentially want typeclasses. No ?
<whitequark>
wmeyer: not the best perhaps? :D
<wmeyer>
and sorry if I was too harsh whitequark I do like when people have opinions, but that's to be balanced
<nicoo>
wmeyer, whitequark : I didn't quite get what was your specific problem with LLVM :o
<mrvn>
nicoo: or gadts. The important part would be the actual code generation side though.
<nicoo>
s/your/wmeyer's/
<whitequark>
nicoo: my non-problem with LLVM is that it works really good for my use case :)
<wmeyer>
not the best yes :)
<nicoo>
mrvn: Wouldn't you need to tag all values (or have a run-type representation of each type variable) for this to work ?
<whitequark>
even ocaml bindings out of the box
<whitequark>
I used to maintain ruby bindings
<whitequark>
that's a huge PITA
<nicoo>
mrvn: (The GADT trick)
<whitequark>
got a wrong type there? SEGFAULT
<wmeyer>
yes, llvm has a big community
* whitequark
sighs
<mrvn>
nicoo: No. Look at compare. It has a generic function that works for every type, even for those it also has specialized functions for.
* wmeyer
goes to bed, gentlemen! good night :-)
<wmeyer>
see you tomorrow
<whitequark>
night
<mrvn>
nicoo: and if you only have specific types then the calling function must either know the type or pass on the typeclass specifiers.
<nicoo>
mrvn: Yes, but I don't see how one could write OCaml code that is both polymorphic and optimizable for specific types (without using Obj (and ignoring for now that calls to compare can be optimized (because duplicating code just to deal with compare would be a tad dumb)))
<Drup>
wmeyer: do I have to write a custom rule in myocamlbuild to have title or index options for ocamldoc ?
<nicoo>
(Sorry for the lispified sentence)
<mrvn>
nicoo: you basically write a function foo_int and foo_float and tell the compiler they both make up the foo function.
<mrvn>
nicoo: code duplication but you want that in this case
<nicoo>
mrvn: Ok, you want a whole new mechanism.
* nicoo
headscratches.
<mrvn>
nicoo: If you compare it to C++ then it would be template specialization.
<mrvn>
nicoo: alternatively ocaml could inline functions passed as arguments. Then you could pass (+) or (+.) as appropriate for example.
<nicoo>
mrvn: I fear we would inherit one of the pitfalls of C++ templates, though : that strategy leads to *lots* of binary code being created, yielding higher memory footprint and low perf (instruction cache miss is nasty)
<pippijn>
whitequark: how do you implement general tail calls in llvm?
<nicoo>
pippijn: Easy, you loop back in the to the relevent SSA block.
<pippijn>
nicoo: loop back?
<mrvn>
nicoo: Main cause for that is that g++ inlines all templates up to insane sizes
<whitequark>
pippijn: llvm has an explicit tail call facility
<whitequark>
but it eh... places restrictions on your ABI
<pippijn>
whitequark: like what?
<mrvn>
nicoo: and there is no generic code for a template. It specialized each instance.
<whitequark>
restrictions so severe that Rust even abolished tail calls completely
<pippijn>
whitequark: like "no varargs"?
<whitequark>
you have to use LLVM's fastcc convention
<mrvn>
nicoo: In ocaml you would have special cases for int, float, bool and then 'a for anything else or so.
<whitequark>
(not related to C's fastcall)
<whitequark>
C/C++/whatever
walter has quit [Quit: This computer has gone to sleep]
<whitequark>
some of that is Rust-specific (RAII), some of that isn't
<mrvn>
whitequark: recursion without tail calls sucks
<whitequark>
judge for yourself; I'm not intimately familiar with that issue
darkf has joined #ocaml
<whitequark>
mrvn: only if you iterate via recursion
<mrvn>
whitequark: List.fold_left
<whitequark>
... can be implemented with a loop
<mrvn>
then it isn't recursive
<whitequark>
I don't care, it's a library function :)
<whitequark>
I *think* ExtList takes some standard List functions and either implements them as loops or does some weird tricks to make them tail-recursive
<Drup>
the later
<mrvn>
loops in ocaml are generally slower
<mrvn>
usualy they need references
<Drup>
whitequark: you can look at BatList.map for an example.
<whitequark>
mrvn: and ocaml doesn't optimize references in the local env?
mattrepl has joined #ocaml
<mrvn>
whitequark: badly
<whitequark>
sigh
demonimin has quit [Quit: No Ping reply in 180 seconds.]
demonimin has joined #ocaml
<pippijn>
ref int is fast
<pippijn>
I mean int ref
<pippijn>
whitequark: I think ExtList abuses %identity
<pippijn>
it breaks the type system
<mrvn>
Many list functions can be written better if the list is mutable. Avoids having to construct it backwards.
<whitequark>
pippijn: abuses %identity?
venk has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
<whitequark>
er, how can you abuse that?
<whitequark>
I'm at loss :)
<pippijn>
whitequark: it's a cast
<whitequark>
hm
<pippijn>
unchecked cast
<pippijn>
from any 'a to any 'b
<whitequark>
isn't that Obj.magic ?
<pippijn>
Obj.magic
<whitequark>
oh.
<pippijn>
Obj.magic is external magic : 'a -> 'b = "%identity"
<mrvn>
yes, that is Obj.magic
<whitequark>
mrvn: well, you can Obj.whatever the list to mutate it
<mrvn>
whitequark: that is what it does
<whitequark>
as long as it's confined inside a library, it's ok
<pippijn>
jane street doesn't approve
<whitequark>
the external invariant is intact, so whatever
<pippijn>
but yeah, I have some magic in some high performance code, too :\
<mrvn>
whitequark: you can create a list as record with mutable field and cast it to list in the end.
<whitequark>
jane street ಠ_ಠ ?
<pippijn>
and all parser generators I know (ocamlyacc, menhir, and my own) use magic to implement the universal semantic value type
<whitequark>
mrvn: so list is just like type 'a list = { car : 'a; cdr : list }; ?
<pippijn>
yes
<whitequark>
"just like" being "has the same internal representation"
<whitequark>
neat
<pippijn>
and you can assume that
<pippijn>
it's also exposed in the C api
<whitequark>
I wonder if that will work in javaocaml, js_of_ocaml and the like
<mrvn>
whitequark: type 'a list = Nil | Cons of 'a * 'a list, which happens to be the same as { data : 'a; next : 'a list }
<pippijn>
it does
<mrvn>
or 0 for the Nil
<pippijn>
js_of_ocaml doesn't know about records and types and mutable/immutable
<pippijn>
it just has memory blocks
<whitequark>
pippijn: what about javaocaml?
<pippijn>
probably the same
<whitequark>
I don't quite see that working well with JVM
<mrvn>
pippijn: ocaml doesn't know about them after compiling
<pippijn>
mrvn: that's what I mean
<whitequark>
you really gotta export that information to the bytecode in order to get good optimizations
<pippijn>
js_of_ocaml reads byte code
<pippijn>
and ocaml byte code doesn't have type info
<whitequark>
hm
demonimin_ has joined #ocaml
<whitequark>
I wonder if js_of_ocaml can be sped up by Int32Array and friends
<pippijn>
maybe
demonimin has quit [Ping timeout: 246 seconds]
<whitequark>
or even asm.js *ducks*
<pippijn>
I don't know how fast int32arrays are
<whitequark>
pippijn: their whole point is being fast
<pippijn>
yes
<pippijn>
but what about small ones?
<whitequark>
translating to memory access and an eliminable bounds checking
<mrvn>
there are float arrays in ocaml too
<whitequark>
mrvn: well, Int32Array is a view into a memory buffer or something
<whitequark>
they have stuff for floats as well
<pippijn>
a list is 3 words
<pippijn>
2 data words and a header word
<pippijn>
how fast is int32array for lots of small pieces of memory?
<pippijn>
probably slow
<pippijn>
you could build a memory allocator on top of it
<mrvn>
The point of float array is that the floats aren't boxed. The array is boxed and that is it.
<whitequark>
pippijn: that's what asm.js forces you to do
<pippijn>
and pass around indices into the big memory block as pointers
<whitequark>
yes
<mrvn>
For bits of memory there is Bigarray
<whitequark>
doesn't Bigarray exist only because ocaml's memory system is suboptimal?
<whitequark>
*management
<mrvn>
no
<mrvn>
Bigarrays are references to memory outside the GC heap.
<mrvn>
unmovable but with refrence counting
<whitequark>
oh right, moving GC
<mrvn>
Allows you to use mmap. Makes a big difference for IO functions on large data too.
<pippijn>
what is large data?
<pippijn>
is 4kb large?
<mrvn>
not realy.
<pippijn>
ok
<whitequark>
pippijn: anything bigger than a page
<pippijn>
64kb?
<whitequark>
for mmap
<mrvn>
ocaml splits IO operastion into 16K chunks with strings.
<pippijn>
ah
<mrvn>
And each 16k is memcpy()ed.
<pippijn>
ok, none of my applications operate on large data
<pippijn>
actually
<pippijn>
one does
<pippijn>
downloading media
<pippijn>
but that's not time critical
<whitequark>
imagine copying files
<mrvn>
pippijn: you should just splice the data into the file you save it as.
<whitequark>
or md5'ing them
<whitequark>
that's where you will get the full benefit
<pippijn>
mrvn: yeah, I should
<mrvn>
or inter process communications
<mrvn>
pipes and unix domain sockets
pygmalion has joined #ocaml
demonimin_ has quit [Quit: No Ping reply in 180 seconds.]
<mrvn>
It's not even the memcopy that is so expensive. Every 16k is a syscall and then it needs to get the global interpreter lock.
demonimin has joined #ocaml
<mrvn>
So while one thread does IO the other threads are constantly stopped.
venk has joined #ocaml
pygmalion has quit [Ping timeout: 240 seconds]
alang has quit [Ping timeout: 246 seconds]
csakatoku has joined #ocaml
<Drup>
I really can't wrap my head around ocamlbuild plugins, I'll just wait for wmeyer's answer tomorrow :/
emmanuelux has quit [Quit: emmanuelux]
alang has joined #ocaml
alang has quit [Ping timeout: 268 seconds]
travisbrady has joined #ocaml
madroach has quit [Ping timeout: 248 seconds]
madroach has joined #ocaml
<whitequark>
Drup: what have you stumbled into?
alang has joined #ocaml
Drup has quit [Quit: Leaving.]
alang has quit [Read error: Connection reset by peer]
Neros_ has quit [Ping timeout: 245 seconds]
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
pygmalion has joined #ocaml
pygmalion has quit [Ping timeout: 240 seconds]
ygrek has joined #ocaml
alang has joined #ocaml
q66 has quit [Quit: Leaving]
<rgrinberg>
is there a way to browse cmi files?
csakatoku has quit [Remote host closed the connection]
ben_zen has joined #ocaml
csakatoku has joined #ocaml
<gnuvince>
Can anyone recommend a decent way to ignore some variant fields in unit testing? I have nodes of a tree with extra meta-data included, and I'd like to be able to test my functions without worrying about the meta-data.
osnr has quit [Quit: Leaving.]
ben_zen_ has joined #ocaml
pygmalion has joined #ocaml
ben_zen has quit [Ping timeout: 240 seconds]
gereedy has quit [Ping timeout: 240 seconds]
ben_zen_ is now known as ben_zen
ben_zen is now known as Guest4474
Guest4474 is now known as ben_zen
gereedy has joined #ocaml
shinnya has quit [Ping timeout: 260 seconds]
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
pygmalion has quit [Remote host closed the connection]
ben_zen is now known as broeas
walter has joined #ocaml
broeas is now known as ben_zen
walter has quit [Client Quit]
csakatoku has quit [Remote host closed the connection]
alang has quit [Ping timeout: 245 seconds]
csakatoku has joined #ocaml
csakatok_ has joined #ocaml
mattrepl has quit [Quit: mattrepl]
csakatoku has quit [Ping timeout: 246 seconds]
alang has joined #ocaml
csakatok_ has quit [Ping timeout: 256 seconds]
csakatoku has joined #ocaml
alang has quit [Ping timeout: 240 seconds]
travisbrady has quit [Quit: travisbrady]
osnr has quit [Quit: Leaving.]
csakatok_ has joined #ocaml
csakatoku has quit [Ping timeout: 268 seconds]
breakds has quit [Remote host closed the connection]
Arsenik has quit [Remote host closed the connection]
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
yacks has quit [Quit: Leaving]
ggole has joined #ocaml
bholst has quit [Ping timeout: 264 seconds]
Yoric has joined #ocaml
hkBst has joined #ocaml
hkBst has quit [Ping timeout: 245 seconds]
csakatoku has joined #ocaml
hkBst has joined #ocaml
hkBst has quit [Changing host]
hkBst has joined #ocaml
csakatok_ has quit [Ping timeout: 240 seconds]
csakatok_ has joined #ocaml
ben_zen_ has joined #ocaml
csakatoku has quit [Ping timeout: 264 seconds]
ben_zen has quit [Read error: Connection reset by peer]
ygrek has quit [Ping timeout: 246 seconds]
Simn has joined #ocaml
ben_zen_ has quit [Ping timeout: 246 seconds]
csakatoku has joined #ocaml
csakatok_ has quit [Ping timeout: 256 seconds]
csakatok_ has joined #ocaml
csakatoku has quit [Ping timeout: 268 seconds]
jave has joined #ocaml
csakatoku has joined #ocaml
csakatok_ has quit [Ping timeout: 240 seconds]
csakatok_ has joined #ocaml
csakatoku has quit [Ping timeout: 256 seconds]
csakatoku has joined #ocaml
asmanur has quit [Ping timeout: 260 seconds]
asmanur has joined #ocaml
csakatok_ has quit [Ping timeout: 268 seconds]
csakatok_ has joined #ocaml
csakatoku has quit [Ping timeout: 256 seconds]
rednovae_ has joined #ocaml
olasd_ has joined #ocaml
AltGr has joined #ocaml
csakatoku has joined #ocaml
csakatok_ has quit [Ping timeout: 245 seconds]
rednovae has quit [*.net *.split]
olasd has quit [*.net *.split]
mathieui has quit [*.net *.split]
csakatok_ has joined #ocaml
mathieui has joined #ocaml
Neros has joined #ocaml
csakatoku has quit [Ping timeout: 240 seconds]
cago has joined #ocaml
mika1 has joined #ocaml
olasd_ is now known as olasd
csakatok_ has quit [Ping timeout: 256 seconds]
csakatoku has joined #ocaml
thomasga has joined #ocaml
chrisdotcode_ has joined #ocaml
chrisdotcode_ has quit [Read error: Connection reset by peer]
chrisdotcode has quit [Ping timeout: 256 seconds]
osnr has quit [Quit: Leaving.]
ygrek has joined #ocaml
lusory has joined #ocaml
Yoric has quit [Ping timeout: 245 seconds]
ineol has joined #ocaml
csakatoku has quit [Ping timeout: 248 seconds]
ontologiae_ has joined #ocaml
csakatoku has joined #ocaml
csakatok_ has joined #ocaml
csakatoku has quit [Ping timeout: 268 seconds]
csakatok_ has quit [Ping timeout: 256 seconds]
csakatoku has joined #ocaml
mcclurmc has joined #ocaml
csakatok_ has joined #ocaml
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
csakatoku has quit [Ping timeout: 264 seconds]
osnr has quit [Ping timeout: 246 seconds]
hkBst has quit [Read error: Connection reset by peer]
hkBst has joined #ocaml
hkBst has quit [Changing host]
hkBst has joined #ocaml
hkBst has quit [Read error: Connection reset by peer]
csakatok_ has quit [Ping timeout: 268 seconds]
csakatoku has joined #ocaml
hkBst has joined #ocaml
hkBst has quit [Changing host]
hkBst has joined #ocaml
csakatok_ has joined #ocaml
csakatoku has quit [Ping timeout: 264 seconds]
wmeyer has quit [Ping timeout: 240 seconds]
csakatoku has joined #ocaml
talzeus_ has joined #ocaml
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
talzeus has quit [Read error: Connection reset by peer]
csakatok_ has quit [Ping timeout: 248 seconds]
letoh has quit [Ping timeout: 276 seconds]
letoh has joined #ocaml
osnr has quit [Ping timeout: 240 seconds]
csakatok_ has joined #ocaml
mcclurmc has quit [Quit: Leaving.]
csakatoku has quit [Ping timeout: 246 seconds]
hkBst has quit [Read error: Connection reset by peer]
troydm has quit [Ping timeout: 248 seconds]
yacks has joined #ocaml
hkBst has joined #ocaml
hkBst has quit [Changing host]
hkBst has joined #ocaml
csakatoku has joined #ocaml
csakatok_ has quit [Ping timeout: 268 seconds]
troydm has joined #ocaml
dsheets has quit [Remote host closed the connection]
csakatok_ has joined #ocaml
csakatoku has quit [Ping timeout: 240 seconds]
Yoric has joined #ocaml
mye has joined #ocaml
csakatok_ has quit [Ping timeout: 256 seconds]
csakatoku has joined #ocaml
ulfdoz has joined #ocaml
mcclurmc has joined #ocaml
wwilly has joined #ocaml
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
dsheets has joined #ocaml
DaniG2k has joined #ocaml
DaniG2k has left #ocaml []
osnr has quit [Ping timeout: 240 seconds]
Drup has joined #ocaml
Drup has quit [Client Quit]
Drup has joined #ocaml
Drup has quit [Client Quit]
Drup has joined #ocaml
Drup has quit [Client Quit]
Drup has joined #ocaml
Drup has quit [Client Quit]
Drup has joined #ocaml
Drup has quit [Client Quit]
Drup has joined #ocaml
ttamttam has joined #ocaml
Drup has quit [Client Quit]
Drup has joined #ocaml
Drup has quit [Ping timeout: 240 seconds]
mort___ has joined #ocaml
zorl has joined #ocaml
q66 has joined #ocaml
oriba has joined #ocaml
yacks has quit [Ping timeout: 240 seconds]
Drup has joined #ocaml
Drup has quit [Client Quit]
Drup has joined #ocaml
ulfdoz has quit [Ping timeout: 264 seconds]
skchrko has joined #ocaml
csakatoku has quit [Remote host closed the connection]
_andre has joined #ocaml
Drup has quit [Quit: Leaving.]
Drup has joined #ocaml
dsheets has quit [Ping timeout: 264 seconds]
venk` has joined #ocaml
venk has quit [Ping timeout: 268 seconds]
ygrek has quit [Ping timeout: 248 seconds]
yacks has joined #ocaml
testcocoon has quit [Ping timeout: 248 seconds]
dsheets has joined #ocaml
tobiasBora has joined #ocaml
osnr has joined #ocaml
osnr has quit [Ping timeout: 246 seconds]
csakatoku has joined #ocaml
ollehar has joined #ocaml
mcclurmc1 has joined #ocaml
mcclurmc has quit [Read error: Connection reset by peer]
mcclurmc1 is now known as mcclurmc
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
csakatoku has quit [Ping timeout: 240 seconds]
osnr has quit [Ping timeout: 246 seconds]
tobiasBora has quit [Quit: Konversation terminated!]
smondet has joined #ocaml
hkBst has quit [Quit: Konversation terminated!]
ygrek has joined #ocaml
breakds has joined #ocaml
zorl has quit [Ping timeout: 250 seconds]
tobiasBora has joined #ocaml
travisbrady has joined #ocaml
travisbrady has quit [Client Quit]
travisbrady has joined #ocaml
oriba has quit [Quit: oriba]
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
osnr has quit [Ping timeout: 268 seconds]
amirmc has joined #ocaml
mcclurmc has quit [Quit: Leaving.]
hcarty_ is now known as hcarty
ollehar has quit [Ping timeout: 248 seconds]
<hcarty>
Can you use the ancient library from the toplevel or bytecode in general?
<hcarty>
The opam package doesn't install the C stubs .so and from what I can see the upstream source doesn't either.
wwilly has quit [Remote host closed the connection]
travisbrady has quit [Quit: travisbrady]
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
darkf has quit [Quit: Leaving]
osnr has quit [Ping timeout: 252 seconds]
travisbrady has joined #ocaml
csakatoku has joined #ocaml
thomasga1 has joined #ocaml
thomasga has quit [Read error: Connection reset by peer]
demonimin has quit [Remote host closed the connection]
walter has joined #ocaml
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
ollehar has joined #ocaml
shinnya has joined #ocaml
demonimin_ has joined #ocaml
ygrek has quit [Ping timeout: 241 seconds]
ttamttam has quit [Quit: ttamttam]
AltGr has quit [Quit: Konversation terminated!]
ontologiae_ has quit [Ping timeout: 264 seconds]
ulfdoz has joined #ocaml
mort___ has quit [Ping timeout: 246 seconds]
csakatoku has quit [Remote host closed the connection]
dsheets has quit [Ping timeout: 240 seconds]
thomasga1 has quit [Quit: Leaving.]
ontologiae_ has joined #ocaml
osa1 has quit [Quit: Konversation terminated!]
csakatoku has joined #ocaml
csakatoku has quit [Ping timeout: 240 seconds]
snearch has joined #ocaml
Drup has quit [Ping timeout: 268 seconds]
osa1 has joined #ocaml
tane has joined #ocaml
ontologiae_ has quit [Ping timeout: 264 seconds]
Drup has joined #ocaml
transfinite has joined #ocaml
emmanuelux has joined #ocaml
bji has joined #ocaml
<bji>
Hello there
<companion_cube>
hi bji
<bji>
sorry I am such an ocaml newbie but I have some questions surrounding how to build ocaml code
<bji>
I have a bunch of .ml files and am trying to build them into .cmx files into another directory
<bji>
so I am using commands like ocamlopt -o someplace/foo.cmx -c foo.ml
<bji>
But I get Unbound module errors
<bji>
same thing works if I output into the same directories as the .ml files
<companion_cube>
bji: I think you should try to use a build system, such as ocamlbuild :)
<orbitz>
-I somplace probably
<bji>
Yes I tried -I .
<companion_cube>
it's packaged with ocaml
<bji>
but no luck
<orbitz>
no .
<orbitz>
err
<bji>
perhaps I should use ocamlbuild
<bji>
I am trying to make the haxe Makefiles sane for my purposes
<orbitz>
the moduels that are unbound are in .?
<bji>
which includes not building stuff into the source directory
<bji>
but this is turning out to be difficult
<bji>
yes I believe so
<bji>
The .ml files have things like "open Ast" in them
<orbitz>
isthis the first module?
<bji>
and ast.ml is in the currect directory
<orbitz>
or one that dpeends on a built on?
<orbitz>
you probably need -I sompalce so it can find the cmx's
<bji>
Oh I have to -I the output directory too?
<orbitz>
well it need sto be able to find its dependent moduels
<bji>
Does the directive "open Ast" mean that ocamlopt is going to look for ast.ml?
<orbitz>
no
<bji>
oh
<bji>
hm
<Drup>
bji: I think that what ocamlbuild is doing is copying source files elsewhere and compile them there, you should probably do the same.
<bji>
meh I was hoping to avoid that
<bji>
such a hack :)
<orbitz>
why not just build cmx's in the source dir?
<bji>
If you had any idea how many headaches have been caused by these &@^#&! haxe/hxcpp/nme tools that build stuff into source dirs ...
skchrko has quit [Remote host closed the connection]
<bji>
sorry it's been frustrating, and I just want to go back to good engineering principles and keep my sources separate from my objects, for my sanity
<orbitz>
i can't speak for haxe, it has yet to be a problem for me in ocaml
<bji>
you are probably right, it probaly doesn't matter for haxe
<bji>
it's the subsequent stuff that haxe builds that tends to have problems
<bji>
but I was going to try to not give haxe special treatment in my nuclear bombing of our build system
<bji>
I have hit problem after problem with these tools and I just want to go back to first principles and do *everything right*
<bji>
so that I don't continue to hit weird problems
<bji>
by these tools I mean the various half-assed build systems included in the typical haxe toolchain (hxcpp, nme,e tc)
* orbitz
shrugs, building in source dir has been 'right' for me
<bji>
well haxe also doesn't build incrementally very well
<bji>
it re-builds stuff unnecessarily
<bji>
Makefiles aren't that hard to write but the haxe one is a fairly big pile
<bji>
anyway I'm just venting at this point
<bji>
sorry about that
<Simn>
I tried before to output everything to a different directory, but that didn't work out.
<Drup>
bji: you can try to write a big ocamlbuild plugin for haxe
<bji>
What command line option to ocamlopt will allow it to find the "Ast" module
<Drup>
not sure if it's a sane approach, to be honest
<orbitz>
did you try -I someplace?
<bji>
Sure
<bji>
-I . didn't help
<orbitz>
did you try -I someplace?
<bji>
Yes tried that too
<bji>
-I . -I someplace
<bji>
didn't work
<bji>
I am not sure where this Ast module is supposed to exist
<adrien_>
that shouldn't happen
<Simn>
The makefile uses $(MODULES:=.cmx), you'd have to modify that as well.
<adrien_>
if you have ast.cmi and ast.cmx, -I will work
<orbitz>
where does ast.cmx and ast.cmi exist?
<bji>
oooh
<bji>
it could be an ordering issue
Anarchos has joined #ocaml
<bji>
actually it seems like something else is going on
<Anarchos>
i almost finished my interfacing of ocaml and the Haiku C++ API .
<bji>
Let me investigate futher
<bji>
sorry for the confusion, but it appears that something else is going on: the ocamlopt commands are not emitting .cmx files (silently - no error reported) and so subsequent ocamlopt commands fail to find modules ...
<Anarchos>
bji try 'strace ocamlopt ...' ?
<bji>
ah I see what's going on now
<bji>
I always use make -j 9
<bji>
and that's causing these ocamlopt commands to be run in parallel
<bji>
but that is not correct because some depend on the output of previous commands
<orbitz>
:)
<bji>
sorry about that guys, my fault completely here
<orbitz>
this build stuff for ocaml has been solved in the past
<bji>
?
<bji>
if it's a solved problem, why do the haxe makefiles not work properly :)
ontologiae_ has joined #ocaml
<adrien_>
because make isn't the solution :p
<bji>
it's the only tool that works reliably in my experience ...
<bji>
but it does require that someone who knows what they're doing write the Makefile ...
<adrien_>
well, it's a bit like saying that C and ASM are the only reliable/* languages
<Anarchos>
bji i could never make works with -j 2
<adrien_>
but truth is that make has been designed for C, not OCaml
<adrien_>
and that builds get more complicated
<Drup>
adrien_ : I would not say it's "solved" ;)
<Simn>
I've never had issues with make, OCaml and -j 4
<orbitz>
ocaml builds seem pretty close to c's...
<adrien_>
Drup: I wouldn't either :-)
<adrien_>
orbitz: with .cmi files?
<adrien_>
and both native and bytecode being routinely built?
<bji>
Simn, indeed, I just have to set up the dependencies correctly
<adrien_>
and build order that matters?
<orbitz>
i don't see those as big differences
<Drup>
adrien_ : sorry, it was for orbitz : (you have the same flashy green color on my screen, so I can't read your names ...)
<adrien_>
a build order that matters really is the biggest issue
* orbitz
shrugs
<orbitz>
that's why we have ocamldep :)
<Anarchos>
bji just add a .depend target that runs ocamldep, and add "include .depend" in your makefile
<adrien_>
Drup: well, that's your issue: stop using these colours :P
<adrien_>
orbitz: it doesn't work ='(
<bji>
Thanks Anarchos, I was not aware of ocamldep
<adrien_>
orbitz: it's too limited: it won't do the difference between Foo and (open Foo;; Foo)
<bji>
ocamldep
<bji>
nice
<bji>
doesn't know anything about -o, so can't emit dependencies that are situated in the output directory
ggole has quit [Ping timeout: 264 seconds]
tane has quit [Quit: Verlassend]
ollehar has quit [Ping timeout: 268 seconds]
ollehar has joined #ocaml
osa1 has quit [Ping timeout: 276 seconds]
mort___ has joined #ocaml
bji has quit [Remote host closed the connection]
ontologiae_ has quit [Ping timeout: 240 seconds]
gnuvince has quit [Changing host]
gnuvince has joined #ocaml
mfp has quit [Read error: Connection reset by peer]
tlockney has quit [Ping timeout: 248 seconds]
tlockney has joined #ocaml
osnr has quit [Quit: Leaving.]
ollehar has quit [Ping timeout: 268 seconds]
walter has quit [Quit: This computer has gone to sleep]
_andre has quit [Quit: leaving]
bji has joined #ocaml
<bji>
So ocamlopt when given the -a option seems to generate temporary files ending in ".cmi"
<bji>
it generates these next to the source files
<bji>
is there any way to tell ocamlopt where to put these temporary files?
<adrien_>
errrr
<adrien_>
cmi files aren't temp files at all
<bji>
oh ok
<adrien_>
they hold the interface of the module matching the file
Neros has quit [Ping timeout: 240 seconds]
<bji>
OK is there any way to specify where they should be output to?
<adrien_>
same folder is good
<bji>
OK so I guess we're back to 'the tool doesn't let you decide'?
<bji>
I guess I give up
<adrien_>
not really
Neros has joined #ocaml
<adrien_>
the thing is that cmi files have to be found for cm{a,x,o,xa} to be usable
<adrien_>
(or at least some of these)
<bji>
that's what search paths are for
<bji>
anyway why not put them next to the .cm{a,x,o,xa} files
mort___ has quit [Quit: Leaving.]
<bji>
instead of next to the source files they came from?
<mrvn>
cmi files are needed to type check
<mrvn>
they aren't source
<bji>
exactly
<bji>
so they shouldn't be put next to the sources, right?
<gasche>
you don't need to
<mrvn>
so why should they got to the source dir instead of the build dir?
<bji>
that's where ocamlopt puts them
<bji>
I sure don't want it to
<mrvn>
it puts them where it puts the other files too
<bji>
Well, if I make the current directory unwritable
<bji>
ocamlopt fails trying to write xxx.cmi in the current directory
<adrien_>
I had misunderstood; "ocamlopt -a foo.ml -o bar/foo.cmxa" will put foo.cmi and foo.cmx in .
<adrien_>
and foo.a and foo.cmxa in bar
<adrien_>
which, I agree, is fairly annoying
<bji>
yeah this is why I ask, how can I tell ocamlopt where to put this stuff?
<mrvn>
well, if you override the location for some file but not others you get a mess
<adrien_>
you could build cmi files separately I guess
<bji>
hm, I'll look into that.
<Anarchos>
bji cmi files are just similar to compiled version of .h files, if that may exist
<bji>
that's nice, but I want them to go into my output directory, not my source directory
<bji>
and I want a search path to tell the ocaml tools where to find them
osa1 has joined #ocaml
<mrvn>
well, my oasis puts everything in _build/
<gasche>
the correct thing to do
<bji>
how does it do that?
<gasche>
is to have a .mli and a .ml for each compilation unit
<gasche>
ocamlc -a -o destdir/lib.cma destdir/lib.cmo
<bji>
thank you
<gasche>
if you don't have a .mli for a given module
<gasche>
OCaml will produce a .cmi on the side while compiling the cmo/cmx
<bji>
I am so sorry about my tone but this has been very frustrating, part of the problem is that I am just trying to make stuff work without really understanding the fundamentals
<gasche>
and you may lose the opportunity to specify its location at this point
<gasche>
but that is a bad practice
<bji>
basically the haxe makefile builds a bunch of .cmxa files from "libraries", then from those libraries and some top level .ml/mli files it builds an executable
<bji>
But in doing so it puts stuff all over srcdir
<bji>
and I am trying to rewrite the makefiles to not do that
<gasche>
the easiest way out would probably be for you to move the stuff you don't like after in a shell script the build step
<Anarchos>
bji if you have the source tree of the ocaml compilers, you can have a look at them : they are a sane source of inspiration
<bji>
I know make well but know nothing about ocaml
<gasche>
(I have no issue with your tone and I don't think anybody has, but thank you for your consideration)
<bji>
I just look at file names, and the existing rules, and try to write new rules that have controlled output directories
<bji>
but not understanding the fundamentals is getting me into trouble
<gasche>
it's true that the user interface of the compiler is a bit odd
<bji>
I am used to stuff like 'gcc -o output/foo.o src/foo.c'
<gasche>
in retrospect I think some things (such as the absence of decision on whether it's legal to separate a .cmi from its .cmo and put it in another directory) could be made easier
<bji>
the funny thing is, and I am sorry to cause confusion because of this, I have no idea what a 'cmi' or a 'cmo' even is !!!
<gasche>
but there is also the fundamental problem that OCaml does strong type-checking of separately compiled module, and is necessarily less flexible than less-picky languages because of that
* Anarchos
often does ocamlc -o *.ml ; rm *.cm[iox] to build/delete the files
<gasche>
bji: foo.cmi represents all the typing information about foo.ml; foo.cmo is the object file as you know it
<bji>
and .cmx?
<Anarchos>
gasche the more annoying is that you can't have a.ml and A.ml residing in the same directory...
<gasche>
when compiling a module bar.ml that uses Foo, the compiler needs foo.cmi to make sure you don't use Foo in a type-incorrect way
<bji>
well a.ml and A.ml would be bad practice anyway as it causes trouble on case-insensitive filesystems ...
<Anarchos>
bji cmx are native code compiled file (opposed to .cmo which are bytecode compiled)
<gasche>
Anarchos: surely a bad idea if you move your source through a case-insensistive filesystem
<adrien_>
Anarchos: if you do that, I'll hunt you and find you
<Anarchos>
gasche lol
<gasche>
yes, some of those do still exist sometimes
<Anarchos>
gasche i remember old times when i could type accented identifiers in camllight :)
<gasche>
(but I admit "ocaml source files" is not the kind of stuff I often move to such legacy (virtual or not) machines)
<Anarchos>
but no uppercase for the file name...
<gasche>
you can use either uppercase and lowercase, but not both
<Anarchos>
gasche you could also support 7bit ascii characters as Knuth did in TeX ;)
<bji>
well I gave up
<bji>
for now I'm just going to let haxe build itself in my source tree
<bji>
really it wasn't the haxe build that was causing the problem anyway
<bji>
it was other tools later on in my build
<bji>
thanks anyway for your help
<gasche>
no problem
<gasche>
bji: note that if you use a version-control system it's rather easy to spot buildfiles that have been generated and remove them once the stuff you care about is built
<bji>
well in our environment it's a little more complicated than that
<bji>
I should be able to build multiple 'flavors' of build simultaneously
<bji>
but cannot due to file name conflicts of files generated into source tree
<bji>
this is not an ocaml problem, it's a problem with the build tools built on haxe that we use
<bji>
such as those provided by 'hxcpp' and 'nme'
<bji>
actually it's apparently an ocaml problem too, but we only ever build one 'flavor' of haxe itself so in that case we don't really care
<bji>
I wanted to set my entire source tree to read-only and then see the build succeed; the first tool that failed to build itself in this mode was haxe and hence my investigation of getting the haxe makefiles to exercise the ocaml compilers in a way so as not to generate stuff into the source
<bji>
but I now officially give up on haxe and move onto the real problem, which is stuff that we actually do build for multiple platforms
<bji>
I have to say that when people design build systems that don't use the wisdom learned by previous generations of tool makers, this is why we end up with these problems
<bji>
but that's just whining, and I apologize
<adrien_>
keep in mind that caml isn't a new language
csakatoku has joined #ocaml
<bji>
I'm talking more about the tools that were created using haxe, which itself, isn't even related to ocaml except that it's written in ocaml
<bji>
so I'm kind of ranting in the wrong forum at this point
csakatoku has quit [Ping timeout: 240 seconds]
dsheets has joined #ocaml
mcclurmc has joined #ocaml
demonimin_ is now known as demonimin
dsheets has quit [Remote host closed the connection]
bji has quit [Remote host closed the connection]
dsheets has joined #ocaml
dsheets has quit [Remote host closed the connection]
ollehar has joined #ocaml
<orbitz>
my prety printer sucks
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
dsheets has joined #ocaml
<Anarchos>
orbitz why ?
<mrvn>
.oO(because it is ugly?)
<orbitz>
the output is ugly
mye has quit [Quit: mye]
Sim_n has joined #ocaml
Simn has quit [Ping timeout: 240 seconds]
tane has joined #ocaml
snearch has quit [Quit: Verlassend]
Anarchos has quit [Read error: Connection reset by peer]
ulfdoz has quit [Ping timeout: 268 seconds]
mort___ has joined #ocaml
Anarchos has joined #ocaml
<Anarchos>
sorry, i crashed
Sim_n has quit [Quit: Leaving]
tane has quit [Quit: Verlassend]
Anarchos has quit [Quit: sleep time]
mcclurmc has quit [Quit: Leaving.]
wmeyer has joined #ocaml
<wmeyer>
hi pippijn Drup mrvn whitequark
<wmeyer>
ping adrien_oww adrien_
<Drup>
hi wmeyer
* adrien_
runs to his bed and hides under the sheets
* adrien_
surfaces at once because it's too hot
<adrien_>
I'm going to look at chambart's patch in the next few days but I don't know if I'm going to be able to fix the build issues we had last time
* adrien_
-> bed
<companion_cube>
bed := Some adrien_
<companion_cube>
hmmm, a bed can contain friendly people in addition, so bed := [ adrien_ ] ;;
<wmeyer>
;-)
* wmeyer
failed to go to bed today so far
ineol has quit [Quit: ineol]
<companion_cube>
bed := [ wmeyer; adrien_ ];;
<wmeyer>
adrien_: no worry, let's see if we can make it
<wmeyer>
companion_cube: i am not sure if I am friendly today though :-], enough stresses at work ;)
<companion_cube>
see that with adrien_ :p
* wmeyer
noticed an AArch64 backend for OCaml
<companion_cube>
bed := [ adrien_ ; friendly_of_grumpy wmeyer ];;
<wmeyer>
that should be bed := [ adrien_ ] @ friendly_of_grumpy wmeyer;; companion_cube
<companion_cube>
you actually are several people in one IRC nickname? interesting
<companion_cube>
adrien_ :: friendly_of_grumpy, also
<wmeyer>
friend_or_grumpy <- returns empty list if if I am grumpy
<companion_cube>
no, it forces you to be friendly :p
<wmeyer>
and BTW: that should be bed := [ adrien_; companion_cube ] @ friendly_of_grumpy wmeyer
<wmeyer>
ah I see companion_cube
<companion_cube>
:D
<companion_cube>
let's all go to #ocaml-bed
venk` is now known as vpit3833
mort___ has quit [Quit: Leaving.]
travisbrady_ has joined #ocaml
thomasga has joined #ocaml
wmeyer` has joined #ocaml
thomasga has quit [Client Quit]
Neros_ has joined #ocaml
ontologiae_ has joined #ocaml
tlockney_ has joined #ocaml
transfinite has quit [Ping timeout: 240 seconds]
travisbrady has quit [Ping timeout: 240 seconds]
travisbrady_ is now known as travisbrady
ttm has quit [Ping timeout: 240 seconds]
wmeyer has quit [Ping timeout: 240 seconds]
Neros has quit [Ping timeout: 240 seconds]
tlockney has quit [Ping timeout: 240 seconds]
The_third_man has joined #ocaml
tlockney_ is now known as tlockney
transfinite has joined #ocaml
travisbrady has quit [Quit: travisbrady]
walter has joined #ocaml
adrien_ has quit [Read error: Operation timed out]
travisbrady has joined #ocaml
Neros_ has quit [Remote host closed the connection]
Qrntz has quit [Ping timeout: 248 seconds]
Cypi has quit [Ping timeout: 264 seconds]
mrvn has quit [Ping timeout: 258 seconds]
Jenza has quit [Ping timeout: 240 seconds]
mehdid has quit [Ping timeout: 246 seconds]
mrvn has joined #ocaml
vbmithr_ has quit [Read error: Operation timed out]
patronus_ has quit [Read error: Operation timed out]
deavid has quit [Read error: Operation timed out]
bacam has quit [Ping timeout: 256 seconds]
The_third_man has quit [Ping timeout: 240 seconds]
Asmadeus has quit [Ping timeout: 240 seconds]
companion_cube has quit [Ping timeout: 252 seconds]
balouis has quit [Ping timeout: 245 seconds]
ia0 has quit [Ping timeout: 276 seconds]
def-lkb has quit [Ping timeout: 240 seconds]
yroeht has quit [Ping timeout: 256 seconds]
companion_cube has joined #ocaml
Qrntz has joined #ocaml
patronus has joined #ocaml
adrien has joined #ocaml
yroeht has joined #ocaml
deavid has joined #ocaml
balouis has joined #ocaml
Cypi has joined #ocaml
Jenza has joined #ocaml
The_third_man has joined #ocaml
Neros has joined #ocaml
Asmadeus has joined #ocaml
bacam has joined #ocaml
def-lkb has joined #ocaml
ia0 has joined #ocaml
vbmithr has joined #ocaml
ontologiae_ has quit [Ping timeout: 276 seconds]
leo_33 has joined #ocaml
<leo_33>
In mobile networks, data traffic is not evenly distributed. Some sectors/cells have a higher
<leo_33>
concentration of traffic than others. To reproduce this in the case study, the Alcatel-Lucent Radio
mehdid has joined #ocaml
walter has quit [Quit: This computer has gone to sleep]
walter has joined #ocaml
Qrntz has quit [Ping timeout: 248 seconds]
companion_cube has quit [Ping timeout: 248 seconds]
walter has quit [Client Quit]
Qrntz has joined #ocaml
companion_cube has joined #ocaml
balouis has quit [Ping timeout: 276 seconds]
balouis has joined #ocaml
Drup1 has joined #ocaml
Drup has quit [Ping timeout: 268 seconds]
walter has joined #ocaml
walter has quit [Client Quit]
pango has quit [Remote host closed the connection]
walter has joined #ocaml
Drup has joined #ocaml
Drup1 has quit [Ping timeout: 264 seconds]
pango has joined #ocaml
walter has quit [Quit: This computer has gone to sleep]