<introom>
maybe an odd question, I want to develop ocaml. Since there is no ide, so is emacs worth learning for the purpose of writing ocaml?
<flux>
in fact there is an IDE and an Eclipse plugin. I haven't tried those, but I do all my editing in Emacs.
<introom>
my purpose is to get a comfort zone to develop ocaml.
<flux>
I think it's enough to have an editor that has t'type throwback' and some support for evaluating fragments in the ocaml toplevel (ocaml shell)
<flux>
but those are the two features I really suggest to find the the whichever editor/ide you choose
<flux>
the ability to go over an expression and ask what is its type is invaluable when debugging type errors
<flux>
and the ability to throw code to be interactively evaluated is extremely nice when writing small functions and verifying their behavior
<introom>
flux: and these are well supported in Emacs?
<flux>
yes
ttamttam has joined #ocaml
Yoric has joined #ocaml
mika1 has joined #ocaml
ben_zen has joined #ocaml
Watcher7 is now known as Watcher7|off
<ygrek>
introom, if you've got less than 8 limbs - consider vim
zpe has joined #ocaml
<introom>
ygrek: I saw most people write ocaml with emacs.
<ygrek>
those were not people!
<ygrek>
most humans write ocaml with vim
<introom>
really?
<ygrek>
trust me
<ygrek>
once you dissect those "'people" - all sectoids
<ygrek>
done that, been there
<introom>
actually what I care about is these two editors' library/package support for ocaml.
ben_zen has quit [Ping timeout: 246 seconds]
<gasche>
introom: there are heavy-ocaml-users using either Vim and Emacs
<gasche>
pick whichever of the two you prefer, you won't be limited
zpe has quit [Ping timeout: 240 seconds]
jbrown has joined #ocaml
<ygrek>
gasche, heavy-ocaml users or heavy ocaml-users ??
<gasche>
indeed
<introom>
I am inclined to use vim as I was a vim user.
<ygrek>
phew.. one more innocent soul saved
* ygrek
gets the cookie
pootler has joined #ocaml
ontologiae has joined #ocaml
wagle has quit [Remote host closed the connection]
cago has quit [Ping timeout: 240 seconds]
pootler_ has joined #ocaml
vext01_ is now known as vext01
gautamc has quit [Read error: Connection reset by peer]
wagle has joined #ocaml
ggole has quit []
thomasga has joined #ocaml
hyperboreean has joined #ocaml
gautamc has joined #ocaml
UncleVasya has joined #ocaml
Yoric has quit [Ping timeout: 252 seconds]
rly has quit [Quit: WeeChat 0.4.2-dev]
<orbitz>
anyone aware of a base64 encode/decode module?
<pippijn>
orbitz: extlib has one
<orbitz>
k
<companion_cube>
cryptokit too, probably
<orbitz>
cryptokit is too much of a dep
<orbitz>
I might rip out the extlib one if license allows and make its own repo
<orbitz>
and package
<adrien_oww>
wwwwhhhhhhyyyyyyyy??????????
<adrien_oww>
gasche!!!!!!
<orbitz>
Because I want smalelr dep!
ashleyis has quit [Ping timeout: 246 seconds]
<companion_cube>
:D
jlouis_ is now known as jlouis
gnuvince has quit [Ping timeout: 268 seconds]
<ygrek>
don't forget to rip kernel and glibc too
<adrien_oww>
what I really dislike with the current state is that when you're shipping something, there are > 50% of dead code
<adrien_oww>
so I really wish we can get lexifi's tool for dead code removal
UncleVasya has quit [Remote host closed the connection]
<orbitz>
adrien_oww: that from native code?
<adrien_oww>
yes
<adrien_oww>
I wish we at least had stats
<orbitz>
that would make me very happy
<adrien_oww>
maybe that there are only 5% dead code and the rest is actually used
<orbitz>
I think it would cut my binaries down a lot, and I run things on VPS so RAM is at a relative premium
<adrien_oww>
I should have asked or mailed Esther
<orbitz>
there was a breif discussion of this on the mailing list awhile ago but nobody mentioned lexifi
<adrien_oww>
oups from a few weeks ago
<adrien_oww>
it needs a fairly new compiler and other things
<adrien_oww>
which means that you cannot just send your ELF file and ask how much would be saved
<orbitz>
ah
<adrien_oww>
iirc
avsm has quit [Ping timeout: 276 seconds]
<adrien_oww>
I'm fairly curious about the savings for a lablgtk2 application
<adrien_oww>
and a batteries one
<adrien_oww>
and maybe core and ocamlnet
ben_zen has joined #ocaml
<orbitz>
adrien_oww: did lexifi say they were goignto open it up, or just teasing us?
<adrien_oww>
that was not mentionned
<adrien_oww>
I don't think it's a terribly complicated tool so it could be opened
zpe has joined #ocaml
ollehar has joined #ocaml
ben_zen has quit [Ping timeout: 276 seconds]
zpe has quit [Ping timeout: 268 seconds]
zpe has joined #ocaml
shepard` has joined #ocaml
<shepard`>
hi there
pootler_ has quit [Ping timeout: 240 seconds]
<shepard`>
got a question about .mll files, related to emacs, should I ask here or in #emacs ? :p
<shepard`>
or in #tuareg-mode ?
pootler_ has joined #ocaml
jayprich has joined #ocaml
<shepard`>
Here is the question anyway: the first rule aligns correctly, but when I use [and rule xxx = parse ...], the following matches don't align correctly anymore, is this a known bug/limitation or is it intentional ?
eikke has joined #ocaml
zpe has quit [Remote host closed the connection]
ashleyis has joined #ocaml
mika1 has quit [Quit: Leaving.]
ttamttam has quit [Quit: ttamttam]
ttamttam has joined #ocaml
ggole has joined #ocaml
ontologiae has quit [Read error: Connection reset by peer]
csakatoku has quit [Remote host closed the connection]
csakatoku has joined #ocaml
ontologiae has joined #ocaml
mika1 has joined #ocaml
skchrko has joined #ocaml
Yoric has joined #ocaml
mcclurmc has joined #ocaml
dsheets has joined #ocaml
Drup has joined #ocaml
<eikke>
is there anything to 'inline' Sexp.t's in code without using string formatting and of_string?
<eikke>
(which is kinda annoying when trying to multi-line things)
<eikke>
(basically, being able to write e.g. <:sexp ((T\n(I 10)\n))> )with \n being true newlines & whitespace
q66 has joined #ocaml
cdidd has quit [Read error: Operation timed out]
ousado has quit [Ping timeout: 246 seconds]
Drup has quit [Quit: Leaving.]
Drup has joined #ocaml
ollehar has quit [Ping timeout: 240 seconds]
zpe has joined #ocaml
Drup has quit [Ping timeout: 268 seconds]
zpe has quit [Ping timeout: 260 seconds]
avsm has joined #ocaml
avsm has quit [Remote host closed the connection]
avsm has joined #ocaml
ggole has quit [Ping timeout: 268 seconds]
ollehar has joined #ocaml
_andre has joined #ocaml
gnuvince has joined #ocaml
jayprich has quit [Ping timeout: 246 seconds]
fayden has quit [Read error: Connection reset by peer]
ousado has joined #ocaml
cago has joined #ocaml
avsm has quit [Ping timeout: 256 seconds]
osa1 has joined #ocaml
csakatoku has quit []
csakatoku has joined #ocaml
ben_zen has joined #ocaml
remyzorg_ has joined #ocaml
zpe has joined #ocaml
zpe has quit [Remote host closed the connection]
csakatoku has quit []
ousado_ has joined #ocaml
csakatoku has joined #ocaml
ben_zen has quit [Ping timeout: 256 seconds]
ousado has quit [Ping timeout: 268 seconds]
<remyzorg_>
when i write an insert query with macaque, must i mention all the fields ?
Drup has joined #ocaml
csakatok_ has joined #ocaml
ygrek has quit [Ping timeout: 240 seconds]
csakatok_ has quit [Remote host closed the connection]
ousado_ is now known as ousado
csakatoku has quit [Ping timeout: 246 seconds]
ousado has quit [Changing host]
ousado has joined #ocaml
UncleVasya has joined #ocaml
thomasga has quit [Remote host closed the connection]
thomasga has joined #ocaml
fayden has joined #ocaml
remyzorg_ is now known as remyzorg
cago has quit [Ping timeout: 260 seconds]
cago has joined #ocaml
ocp has joined #ocaml
ashleyis has quit [Ping timeout: 256 seconds]
remyzorg has quit [Ping timeout: 240 seconds]
zpe has joined #ocaml
zpe has quit [Ping timeout: 256 seconds]
<shepard`>
now that OCaml supports first-class modules, is it possible to write a function, taking a list as argument, and returning a module containing this list ?
<shepard`>
My goal is to wrap a list into a module in order to pass that module as a parameter to menhir.
<mrvn>
let f l = let M = struct let l = l end in M?
<shepard`>
for example, can I write something like "let f l = struct let l = l end"
<companion_cube>
you have to wrap the module as a value afterwards
<thomasga>
shepard`: first-class modules are very similar to records actually
<shepard`>
Unfortunately, I'm still quite a beginner :p companion_cube, could you elaborate a bit, please ? :$
<thomasga>
but you have to use some (heavy?) syntactic sugars to use them
<companion_cube>
shepard`: there is a difference between values and modules
<shepard`>
mrvn: it gives me a syntax error
<companion_cube>
so, if you want to make a value out of a module, you need to use first-class module syntax
<mrvn>
let f l = let module M = struct let l = l end in (module M : L);;
<mrvn>
Error: Signature mismatch: Modules do not match: sig val l : '_a end is not included in L Values do not match: val l : '_a is not included in val l : 'a list
<mrvn>
How does one get the 'a as type parameter for a module?
<shepard`>
oh, I don't need polymorphism actually, its always a list of (strings * int * int) :p I try without polymorphism :-)
<mrvn>
shepard`: then it works as pasted
<shepard`>
Yes :-)
<flux>
mrvn, tried let f : 'a. 'a -> _ = fun l -> let module .. ?
<shepard`>
Thank you everyone for your help !
<mrvn>
module type L = sig type t val l : t list end
<mrvn>
let f (type lt) l = let module M = struct type t = lt let l = l end in (module M : L with type t = lt)
<mrvn>
val f : 'a list -> (module L with type t = 'a) = <fun>
<mrvn>
# f [1;2];;
<mrvn>
- : (module L with type t = int) = <module>
<mrvn>
Seems to work.
tynanch has joined #ocaml
tynanch has quit [Client Quit]
<mrvn>
How do I tell oasis that my executable needs threading?
mort___ has joined #ocaml
<Drup>
mrvn: add "threads" in the "BuildDepends" line
<mrvn>
oh, that was too easy. :)
ygrek has joined #ocaml
gautamc has quit [Quit: Leaving.]
cago has quit [Ping timeout: 268 seconds]
remyzorg has joined #ocaml
testcocoon has quit [Ping timeout: 264 seconds]
testcocoon has joined #ocaml
remyzorg has quit [Read error: Connection reset by peer]
remyzorg has joined #ocaml
mye has joined #ocaml
ben_zen has joined #ocaml
mfp has quit [Ping timeout: 276 seconds]
zpe has joined #ocaml
ben_zen has quit [Ping timeout: 268 seconds]
shepard` has left #ocaml []
shepard` has joined #ocaml
shepard` has quit [Remote host closed the connection]
shepard` has joined #ocaml
zpe has quit [Ping timeout: 276 seconds]
mfp has joined #ocaml
ben_zen has joined #ocaml
gnuvince has quit [Remote host closed the connection]
justdit has quit [Ping timeout: 246 seconds]
cago has joined #ocaml
darkf has quit [Quit: Leaving]
testcocoon has quit [Quit: Coyote finally caught me]
travisbrady has joined #ocaml
alang_ has quit [Ping timeout: 264 seconds]
smondet has joined #ocaml
walter has joined #ocaml
ben_zen has quit [Ping timeout: 240 seconds]
osa1 has quit [Read error: Operation timed out]
osa1 has joined #ocaml
testcocoon has joined #ocaml
gnuvince has joined #ocaml
contempt has quit [Ping timeout: 264 seconds]
contempt has joined #ocaml
thomasga has quit [Quit: Leaving.]
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
contempt has quit [Client Quit]
contempt has joined #ocaml
osa1 has quit [Quit: Konversation terminated!]
zpe has joined #ocaml
zpe has quit [Ping timeout: 260 seconds]
justdit has joined #ocaml
<eikke>
for the Async Epoll backend to work, timerfd support is required, but to enable timerfd support in core, JSC_TIMERFD needs to be defined as a preprocessor macro during stub compilation, which seems not to be the case with a standard opam build
<eikke>
any way to work around this?
travisbrady has quit [Quit: travisbrady]
mika1 has quit [Quit: Leaving.]
travisbrady has joined #ocaml
thomasga has joined #ocaml
shepard` has quit [Remote host closed the connection]
jayprich has joined #ocaml
cago has quit [Quit: Leaving.]
<jdoles>
Doesn't opam work on Ubuntu or something like that?
<avsm>
eikke: i'd report that on the Core Github issue tracker. it should be set by discover.ml when timerfd is enabled
<avsm>
eikke: you could work around it with a local opam package patch that just removes the ifdef
<eikke>
avsm: will inspect further, thanks
zpe has joined #ocaml
<jdoles>
avsm: how does opam try to load libglut.so.3 during the installation of opam install lablgl?
justdit has quit [Ping timeout: 264 seconds]
Watcher7|off is now known as Watcher7
<jdoles>
avsm: ldconfig -v shows that the directory containing that file is being searched.
<avsm>
ocamlfind stublibs dir
<jdoles>
avsm: I can only suspect that opam uses some other method(?).
<jdoles>
avsm: no, those are the stubs it has created itself.
<thomasga>
jdoles: opam just calls 'make'
<thomasga>
it's not a build system, it's a package manager
<jdoles>
thomasga: ok, so lablgl is just a broken package?
<thomasga>
I guess so then
<thomasga>
seems to be working on some arch
<avsm>
possibly on your system. it's worked for me in the past
<jdoles>
If it doesn't work on at least Mac/*BSD/Linux/Cygwin, it's definitely broken.
skchrko_ has joined #ocaml
skchrko has quit [Read error: Operation timed out]
<avsm>
jdoles: have you actually tried it on all those and found it broken on all of them?
<jdoles>
avsm: you might want to take Introduction to Logic again.
<whitequark>
pippijn: ping
<avsm>
jdoles: oh well. so much for trying to help you. It worked for me on MacOS X, so I thought I'd find out which architecture it was broken on.
Simn has joined #ocaml
<avsm>
Report it on the bug tracker if you can come up with a decent test case.
<pippijn>
whitequark: pong
<jdoles>
Makefile.config that has been tested under Linux Mandrake 9.1
UncleVasya has quit [Remote host closed the connection]
<Drup>
is there a way to ask ocamlfind to install some file in a sub directory ?
Yoric has quit [Ping timeout: 276 seconds]
<adrien_oww>
like?
<adrien_oww>
wmeyer: pong
<adrien_oww>
still at work, will have a long way home
<Drup>
adrien_oww: the actual problem is that I want to have two ocamlfind subpackage, a "server" and a "client" and I have modules with the same name in both subpackage so I want to put them in subdirectories. If I don't do that, they would overwrite each other.
<Drup>
adrien_oww: eliom "solve" this problem by copying manually files in a dummy ocamlfind instalation, I hoped for another solution.
bkpt has joined #ocaml
zpe has quit [Remote host closed the connection]
bkpt has quit [Client Quit]
IbnFirnas has quit [Read error: Operation timed out]
Simn has quit [Read error: Connection reset by peer]
lopex has quit [Ping timeout: 264 seconds]
bobry has quit [Ping timeout: 245 seconds]
davekong has quit [Ping timeout: 252 seconds]
jyeo has quit [Ping timeout: 245 seconds]
ggherdov has quit [Ping timeout: 264 seconds]
bobry has joined #ocaml
Simn has joined #ocaml
ggherdov has joined #ocaml
zpe has joined #ocaml
mort___ has quit [Ping timeout: 276 seconds]
mort___ has joined #ocaml
zpe has quit [Remote host closed the connection]
<jdoles>
Drup: I said above that I was on Ubuntu already.
ollehar has quit [Read error: Operation timed out]
<jdoles>
(but you made it clear that you use MacOSX (the platform on which usually nothing works)).
<Drup>
jdoles: you also said it fails everywhere, and I have several counter examples to this affirmation, I though you would be interested by some instruction on OS X.
<jdoles>
Drup: no, I did not say that.
<jdoles>
Drup: you can join the class with avsm.
ontologiae has quit [Ping timeout: 241 seconds]
<Drup>
Or you can keep being an asshole and receive absolutly no help, indeed ;)
<jdoles>
Drup: exactly.
<orbitz>
What's going on here?
remyzorg has quit [Read error: Connection reset by peer]
<orbitz>
Please be courteous to each other
remyzorg has joined #ocaml
demonimin has quit [Ping timeout: 245 seconds]
jyeo has joined #ocaml
bkpt has joined #ocaml
remyzorg_ has joined #ocaml
demonimin has joined #ocaml
remyzorg has quit [Ping timeout: 260 seconds]
<wmeyer>
adrien_oww: I hope you will have some time to look at the patches this week, so we can commit them. Currently I'm having a flu so maybe not today, but any other day is fine.
<wmeyer>
(and not end of the week or weekend, as I will most likely will not find time)
<pippijn>
wmeyer: you need to take care of your health
<pippijn>
you're sick too often
<wmeyer>
pippijn: thanks
ollehar has joined #ocaml
remyzorg__ has joined #ocaml
tane has joined #ocaml
remyzorg_ has quit [Ping timeout: 260 seconds]
introom has quit [Remote host closed the connection]
lusory has joined #ocaml
breakds has quit [Quit: Konversation terminated!]
pango_ has joined #ocaml
mcclurmc has quit [Ping timeout: 246 seconds]
pootler_ has quit [Ping timeout: 260 seconds]
testcocoon has quit [Quit: Coyote finally caught me]
pootler has quit [Ping timeout: 264 seconds]
pango has quit [Ping timeout: 248 seconds]
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
mort___ has quit [Quit: Leaving.]
<pippijn>
"MLton uses native types, like 32-bit integers, without any penalty due to tagging or boxing. OCaml uses 31-bit integers with a penalty due to tagging, and 32-bit integers with a penalty due to boxing."
<pippijn>
how does it do that?
<pippijn>
does it box them when calling polymorphic functions, or does it specialise those functions?
samebchase has joined #ocaml
remyzorg__ has quit [Quit: Quitte]
osnr has quit [Ping timeout: 276 seconds]
<eikke>
anyone knows what the difference is between Scheduler.within and Scheduler.schedule in Async_core?
<eikke>
(types are the same, and docs are kinda lacking)
testcocoon has joined #ocaml
ygrek has quit [Ping timeout: 240 seconds]
pango_ is now known as pango
<orbitz>
eikke: Sorry I don't
introom has joined #ocaml
introom has quit [Ping timeout: 264 seconds]
pootler has joined #ocaml
pootler_ has joined #ocaml
Drup has quit [Ping timeout: 246 seconds]
Yoric has joined #ocaml
<samebchase>
Can someone please link me to Core's library reference
<wmeyer>
pippijn: it performs region analysis and partial specialisation. (don't ask about the details of region analysis). I think region analysis is conservative, it means not everything is handled. The ocaml compiler always specialises functions and closures, but MLTon goes beyond that and does it in full text scope.
<samebchase>
companion_cube: :-) thanks
<orbitz>
samebchase: I tendto just read the .mli files as well
Yoric has quit [Ping timeout: 276 seconds]
UncleVasya has joined #ocaml
<wmeyer>
so with region analysis the compiler asseses the lifetime of objects. If they are returned from function and used in upperscope than you have to box them, if it's immediately downto in the call tree then you can leave it on stack.
<wmeyer>
it's not that trivial in a presence of closures
<wmeyer>
(means I don't believe it's decidable problem)
<companion_cube>
I don't think so either
<companion_cube>
you can probably encode the halting problem in the lifetime of a heap object
<wmeyer>
most likely yes
<wmeyer>
but getting the 90% suffice to improve the performance significanlyt on a heavily numerical code
<wmeyer>
(if you ask, MLTon is state of art in optimisations)
<pippijn>
wmeyer: but ocaml beats mlton on ackermann ;)
<pippijn>
wmeyer: and ocaml doesn't even have particularly smart optimisation for that
<pippijn>
wmeyer: it's a pretty direct transformation to asm
<pippijn>
wmeyer: Clean produces almost the same code as ocaml (it's slightly faster)
<wmeyer>
pippijn: because we want correctness in the first place and performance in the second place, unlike MLton
<pippijn>
mlton should want correctness, too
<wmeyer>
of course it wants, but the tricks it does are complex
<pippijn>
correctness should always be the #1 goal
malo has joined #ocaml
<wmeyer>
but it's not that always easy to marry that with performance
<wmeyer>
(not claiming that MLton is buggy or anything)
<pippijn>
yeah
<pippijn>
optimisations are weird
<pippijn>
you often can't know whether performing a particular optimisation is useful or not
<wmeyer>
often they fight with each other, for instance often efficient instruction selection and peephole optimisations can degradate poerformance rather improve it
Yoric has joined #ocaml
<companion_cube>
the problem with mlton is the compile time/no separated compilation
<pippijn>
yeah, that's bad for the edit/compile cycle
<pippijn>
I am writing a latex document now
<wmeyer>
companion_cube: you mean no linking stage?
<pippijn>
and on every change, I recompile it and view it in the pdf viewer
davekong has joined #ocaml
<pippijn>
it's immediate
<wmeyer>
whiztex is nice
<pippijn>
and the build directory this latex document is part of contains about 17500 files in about 950 directories
jyeo has quit []
lopex has joined #ocaml
<wmeyer>
pippijn: :D you always produce so much code in a unit of time.
<pippijn>
that's how an edit/compile cycle should be
<pippijn>
the recompilation is *immediate*
IbnFirnas has joined #ocaml
<pippijn>
like, 0.1 seconds after the file was changed
Zerker has joined #ocaml
<wmeyer>
if you use inode and the file has no dependencies, then why it should not be possible
<pippijn>
wmeyer: not all of that is my code
<pippijn>
inode?
<pippijn>
you mean inotify?
<wmeyer>
yes inode listener, yes inotify
<wmeyer>
so you use -P flag?
<wmeyer>
nice
<pippijn>
inotify watches directories
<adrien>
the API can watch files
<adrien>
rely on that
<wmeyer>
checkout whizztex, although i believe it's an Emacs package only
<adrien>
hold on
<adrien>
the API rely on files
<pippijn>
I wonder how many files it can watch
<adrien>
do *not* rely on that: instead, always watch directories and filter what you need
<adrien>
man 7 inotify
<adrien>
wmeyer: we're geting close to shipping at work
<adrien>
rather: close to trying
<pippijn>
I also wonder whether omake does inotify on files or directories
<wmeyer>
adrien: ok, just wanted to hear an update. Absolutely there is no rush here.
<pippijn>
it's a pity that omake is no longer being developed
<pippijn>
it's going to die
<wmeyer>
adrien: the daytime job is more important
<pippijn>
I will leave it someday
Zerker has quit [Remote host closed the connection]
beckerb has quit [Ping timeout: 245 seconds]
<companion_cube>
wmeyer: it's global optimization, afaik
<wmeyer>
indeed, it requires to know each function during compilation, and not only a signature
<wmeyer>
companion_cube: btw, hi :-)
<wmeyer>
and adrien & pippijn: hi!
* wmeyer
is a bit tired today
osa1 has joined #ocaml
<adrien>
o/
<wmeyer>
\o
Arthur_ has joined #ocaml
<adrien>
last week at work on one of the subprojects, we went back from the dev version to the production one
Guest42040 has quit [Read error: No route to host]
<adrien>
no time to stabilize the dev version
<adrien>
I was the one who came up with the idea at first but I also warned that even though we hadn't had issues with the production version yet, that was pure luck
<adrien>
I said issues were bound to happen
<adrien>
guess what happened today \o/
<wmeyer>
don't know, I can imagine something really good or a disaster
<adrien>
I still don't know; I only know things fail
<adrien>
at work, for our devs, but also in production
ocp has quit [Read error: Operation timed out]
<companion_cube>
hi wmeyer !
<wmeyer>
adrien: it's always like this actually, you are a Software Engineer so the day without issue is non working day :-)
<companion_cube>
I've spent the day writing C
<wmeyer>
good stuff :-)
<adrien>
oh, we have a big backlog of work
PM has quit [Read error: Operation timed out]
<wmeyer>
companion_cube: I like to write some C along with Coq actually. But will *never again* made the same mistake of writing complex C without just gdb session.
<wmeyer>
adrien: unfortunately we all need to do the day time job, I have my backlog too, and it's way too big
<companion_cube>
without just gdb?
<companion_cube>
with* ?
<companion_cube>
well, here it's going to be assert() :)
<companion_cube>
the code is much too complex for coq anyway
<wmeyer>
I'm impressed how well the type inference works in Coq, given the dependent typing
<wmeyer>
yes, assert is fine, but I would not go to far with it when debugging complex code to be honest :-)
<wmeyer>
more over I don't like to even, (I went through that; and eventually used gdb session)
ollehar has quit [Ping timeout: 264 seconds]
<pippijn>
wmeyer: LTO marries separate compilation with whole program optimisation
ollehar has joined #ocaml
<pippijn>
wmeyer: with ocaml, .cmx files are used for inlining, and they could as well be used for other optimisations
<wmeyer>
but you have to include the AST in some form
<pippijn>
or IR
<wmeyer>
or IR
PM has joined #ocaml
<pippijn>
with C, that is not so easy, it needs to be at link time, because the compilation order could be any, and because of mutual dependencies..
<pippijn>
ugly ugly
<pippijn>
I like languages that prohibit mutual dependencies
<pippijn>
once you eliminate mutual dependencies, there is no need for header files, anymore
<pippijn>
you can model the compilation as file inclusion
<companion_cube>
well, headers are not so bad
<adrien>
LTO of firefox with MSVC takes too much memory for 32bit systems
<companion_cube>
for the same reason .mli exist
<pippijn>
they are nice for documentation
<adrien>
separate compilation exists for speed ;-)
pootler_ has quit [Ping timeout: 260 seconds]
pootler has quit [Ping timeout: 260 seconds]
<pippijn>
adrien: you could have incremental "LTO"
<wmeyer>
companion_cube: while I agree, but #include is evil
<pippijn>
that's not really link time
<pippijn>
by including IR into the object files
<companion_cube>
wmeyer: yeah, sure
<pippijn>
and when compiling a file, you can look up definitions in the object files it depends on
<wmeyer>
so why you need precompiled binaries on object file anymore
<wmeyer>
pippijn: ?
<wmeyer>
if you plan to do the full text why bother
<pippijn>
full text? no
<wmeyer>
it just removes burden of parsing
<adrien>
pippijn: I'm waiting for it to appear; until then, I don't consider it as available ;-)
<wmeyer>
that's what MLton do, and Haskell for stdlib
<pippijn>
the point of having machine code in .o files is that you can link it together with reasonable memory usage
<wmeyer>
it's useful only for different optimisations switch i believe
<wmeyer>
like -O0 will do the job on the level of binaries
<pippijn>
what optimisation can't you do with separate compilation?
<wmeyer>
where -03 will do the full text
<wmeyer>
the ones that don't need full environment
<pippijn>
*can't*
<pippijn>
I'm advocating separate compilation
<pippijn>
and I'm saying: there is no need to kill separate compilation
<wmeyer>
i am after balanced version of separate compilation and full text in some cases
<wmeyer>
pippijn: nobody will do this
<pippijn>
mlton did
<wmeyer>
comercial libraries are being shipped everyday in TB
<wmeyer>
so, in that setting you have to be careful, it's easy to steal the IP
<pippijn>
in java, there is a good reason for whole program compilation
<pippijn>
wmeyer: do what?
<pippijn>
steal what IP?
<wmeyer>
of the companies, that want to protect their source code for instance
<wmeyer>
maybe that was the case many years ago, but not significantly now
<pippijn>
I think I didn't explain myself clearly
<wmeyer>
however it's not easy for some companies to include their AST or even intermediate code without obfuscation
<pippijn>
take C, for instance
<wmeyer>
i am after freedom in software, but can't change how the industry works
<pippijn>
you compile a .c file, and out comes a .o file
<wmeyer>
(i am not a second R Stallman)
<pippijn>
inside the .o file, you can find 1 or 2 things
<pippijn>
one of the things is machine code
<pippijn>
that is always there
<pippijn>
optionally, it includes the IR for the .c code
<pippijn>
c--, gimple, llvm-ir, whatever
<wmeyer>
yeah, but it's very lowlevel, it's a machine code, so what you can do with it, facing high level optimisation
<pippijn>
then, you compile a second .c file
<pippijn>
which uses functions from the first .c file
<pippijn>
if the IR is not present, it just does its regular single-file optimisations as always
<pippijn>
if the IR *is* present, it can use that for global optimisations
<pippijn>
this requires that when compiling file2.c, the C compiler is able to locate file1.o
<pippijn>
then, LTO is no longer required
<adrien>
LTO works by adding more information to .o files
<adrien>
what you're describing _is_ LTO as it exists today
<pippijn>
yes, but you don't need to do *all* the optimisations at link time
<pippijn>
adrien: not in GCC
<pippijn>
I don't know msvc
<pippijn>
but gcc does LTO at link time
<adrien>
LTO means link-time optimization
<pippijn>
yes, and I didn't describe LTO
<adrien>
so I expect msvc's LTO to happen at link-time too :D
<pippijn>
if you think I described LTO as it exists today, then I failed again
<wmeyer>
pippijn: problem is that for LTO there is not enough information for the linker for perform heavy optimsations
<adrien>
I'm very tired too
<wmeyer>
for instance the code expands and linker needs to backpatch the offsets
<pippijn>
wmeyer: why?
<wmeyer>
which is not always possible
<wmeyer>
read above
<pippijn>
ok
<pippijn>
I understand that
<pippijn>
but I didn't describe LTO
<pippijn>
in my model, there is no need to backpatch code
<pippijn>
once a TU is compiled, it's fixed
<wmeyer>
so call it properly :-) not LTO, LTO resembles me horrible optimisations that linker has to do
<pippijn>
I didn't call it anything
<wmeyer>
ok
<pippijn>
21:02 < pippijn> then, LTO is no longer required
<pippijn>
this obsoletes LTO
<pippijn>
I don't know what to call it
<pippijn>
but ocaml does it
<pippijn>
ocamlopt that is
<wmeyer>
yes, indeed
<pippijn>
it could be done for C
<pippijn>
except for one problem
<wmeyer>
maybe, I don't know
<pippijn>
mutual dependencies
<pippijn>
they make the possible span of optimisations depend on the build order
<pippijn>
if you compile in inverted topological order (after breaking cycles), you lose most opportunities for intermediate intermodular optimisation
<pippijn>
no, I mean in topological order
<pippijn>
with the most dependent file first
<pippijn>
you need to compile in inverted topological order to maximise the opportunities
<pippijn>
to do that, you need to compile it twice, so you know all the dependencies and then do it again so you have the order right
<wmeyer>
yeah
eni has joined #ocaml
<pippijn>
but that information can be cached and distributed, of course
<pippijn>
it's a text file you can put in your source distribution
<wmeyer>
it's enough. you convinced me for this approach
<pippijn>
for ocaml, you don't need that
<pippijn>
ocamlopt already does what I described
Arthur__ has joined #ocaml
Arthur_ has quit [Read error: Connection reset by peer]
eni has quit [Quit: Leaving]
eni has joined #ocaml
pootler_ has joined #ocaml
pootler has joined #ocaml
breakds has joined #ocaml
zpe has joined #ocaml
zpe has quit [Ping timeout: 256 seconds]
<samebchase>
orbitz: cool. There seems to be quite a lot of information in Core's .mli files.
travisbrady has quit [Quit: travisbrady]
mlh has quit [Ping timeout: 252 seconds]
dsheets has quit [Ping timeout: 240 seconds]
mlh has joined #ocaml
dsheets has joined #ocaml
travisbrady has joined #ocaml
travisbrady has quit [Client Quit]
travisbrady has joined #ocaml
<mrvn>
My network protocol sends boxes with a header and data. The length of data is part of the header. Now should I read the header, parse it and then do a second read for the data or read as much as possible into a big buffer and then parse that?
<mrvn>
The former has more read calls, the later will have to copy left over bytes around. Both kind of suck.
<companion_cube>
if the header contains the size of the body, I'd go with parsing the header first
<companion_cube>
beware the endianess
<mrvn>
Is there a syscall to ask how many bytes are readable from a socket?
<companion_cube>
hmm, no idea
<ousado>
no
<companion_cube>
you may need to fill a string
<mrvn>
Bigarray
<bitbckt>
recv with MSG_PEEK, maybe?
<companion_cube>
do you need this much performance?
<bitbckt>
still not going to be "all" the bytes - TCP is streaming, after all.
<mrvn>
isn't that just for datagram sockets?
<bitbckt>
no.
<ousado>
mrvn:how do you read the data?
tane has quit [Quit: Verlassend]
<mrvn>
ousado: ExtUnix.Specific.BA.single_read
ocp has joined #ocaml
<ousado>
I meant the underlying syscall
<mrvn>
read()
ocp has quit [Client Quit]
Simn has quit [Ping timeout: 276 seconds]
<ousado>
mrvn: do you have an idea abbout the size of the messages you expect?
<mrvn>
at least 4 byte, at most 65540 per message
<mrvn>
But there could be 50 messages in the network buffer
emmanuelux has joined #ocaml
<ousado>
sure. if you care about performance that much, you'll have to be able to dispatch them, even if you get them in one big chunk
<eikke>
i wish ocamldoc output would be on-par with haddock
Simn has joined #ocaml
<mrvn>
ousado: I could allocate a big buffer and then try to read into it and parse whatever I get. But then I would e.g. allocate a 1MB buffer and only get 16 byte. Would be wastefull too.
<ousado>
well, you could reuse that buffer immediately
<mrvn>
not currently. The buffer is passed around to the parser for the data so the socket reader can't reuse it savely.
_andre has quit [Quit: leaving]
<ousado>
if you were writing this in C I'd say use 64K of your stack.
<mrvn>
I'm writing this in ocaml, obviously.
<ousado>
hm. I'd think about trying to read the header immediately after receiving the data
<ousado>
"in the socket reader"
<ousado>
quasi
<mrvn>
That's what I'm currently doing. read header, allocate bigarray for data, read data, parse, repeat
<ousado>
do you control that, or is it part of a framework?
<mrvn>
I'm writing the framework
chrisdotcode has joined #ocaml
* companion_cube
loves textual formats
* pippijn
too
* ousado
hates them
chrisdotcode has quit [Remote host closed the connection]
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
<pippijn>
ousado: why?
<companion_cube>
ousado: since I tried B-encode, I love it
<companion_cube>
it's awesomely simple
<ousado>
well, I like writing such stuff, and binary formats are just easier to handle.
<companion_cube>
I don't think so :p
<pippijn>
I don't think so, either
<pippijn>
they are equally easy to handle
<companion_cube>
ousado: take a look at B-encode, it can contain binary and is easy to parse
<companion_cube>
even from a non-blocking socket
<companion_cube>
it's used in Bittorrent
<pippijn>
binary formats are sometimes necessary for speed
<pippijn>
or size
<mrvn>
ousado: I guess I could add a buffering layer. The parser would tell the buffering layer how many bytes to wait for and provide a callback that uses up the bytes. The buffering layer would use a big ring buffer and copy the requested data in case it hits the overflow.
<ousado>
also I don't like stuff where you have to look at every byte before you know when your message ends
<companion_cube>
ousado: some textual formats allow that
<pippijn>
ousado: prefix it with the length
<companion_cube>
look at B-encode :DD
<ousado>
and if you length-prefix text, it's not a text format anymore :)
<mrvn>
ousado: The buffer passed to the callback would only be valid for the duration of the callback so that the buffering layer can reuse it after.
<companion_cube>
yes it is, if the size is in ascii
<mrvn>
companion_cube: lists and dictionaries aren't.
<companion_cube>
so you can pass bytestrings without escaping
<mrvn>
And strings are byte arrays, not text
<companion_cube>
mrvn: yes, but they are easy to parse
<companion_cube>
(lists)
<mrvn>
companion_cube: you still need to parse it all the way to get the length.
walter has quit [Quit: This computer has gone to sleep]
<companion_cube>
mrvn: oh
<companion_cube>
I don't care about this, as long as strings are length-prefixed
<pippijn>
strings have to be
<mrvn>
companion_cube: yeah, strings without length are totaly horrible. C realy sucks.
<mrvn>
I like network protocols with boxed frames though. If you can't parse a box you still know the length and can skip to the next box.
<pippijn>
we have that in deliantra
<companion_cube>
anyway you can encode any way you want, then B-encode the result as a string
<companion_cube>
so you have the total length
<companion_cube>
(overcomplicated)
<mrvn>
BB-encode
<pippijn>
baby encode
<mrvn>
A binary form of B-encode would be nice.
<pippijn>
asn.1?
walter has joined #ocaml
<mrvn>
not obscure enough :)
<pippijn>
BER
<pippijn>
I like standardised formats
<companion_cube>
mrvn: the nice thing with Bencode is that endianess problems disappear
<mrvn>
converting to text and back is costly though and bloads the data.
<pippijn>
companion_cube: except when you have endianed stuff in those byte strings
<companion_cube>
sure, but if you don't...
<pippijn>
companion_cube: make a syntax extension for ocaml
<companion_cube>
the prefix length is safe
<pippijn>
bbencode_t
<companion_cube>
you mean, a serialization generator?
<pippijn>
bbencoded_of_t
<pippijn>
yes
<mrvn>
you can probably generate b-encode from sexp's s-expressions.
<companion_cube>
aww, I dont't know camlp4
<pippijn>
type t = int deriving (Bencode)
<companion_cube>
:D
<companion_cube>
I have a parser/printer though
<companion_cube>
(incremental parser)
<pippijn>
use as: Bencode.encode<t> 3
<pippijn>
incremental parser!
<pippijn>
how?
<companion_cube>
(by "incremental" I mean that I feed the input to it)
<pippijn>
oh
<pippijn>
a push parser
<pippijn>
boring
<companion_cube>
yes
<companion_cube>
never heard of "push parsers", but nice
<mrvn>
pippijn: you parse as much data as you have and then save the state for the next call with more data.
<pippijn>
yes
<pippijn>
I understand
<pippijn>
that's not as interesting as random incremental parsing like it's done in... I forgot the name
<mrvn>
Only way to parse formats where you don't know the lnegth and you might not get all of the data in a chunk.
<companion_cube>
hmm, so what's incremental parsing,
<companion_cube>
?
chrisdotcode has joined #ocaml
<mrvn>
companion_cube: I guess like the browser displaying a webpage that is half downloaded
<companion_cube>
ohhh
<companion_cube>
ok, that's a totally different level of smartness :D
<pippijn>
no
<pippijn>
but yeah, that's also nice
<pippijn>
I mean
<mrvn>
producing a valid result from partial data and incrementally improving it as more input comes in is harder than simply pushing input till you got a complete chunk.
<pippijn>
actually yes, that too
<companion_cube>
push parsers are indispensable for blocking IO
<companion_cube>
(unless you use threads)
<mrvn>
companion_cube: you mean non-blocking IO
<pippijn>
also, editing in the middle only parses the middle
<companion_cube>
err, yes
zpe has joined #ocaml
<pippijn>
and inserts it into the AST, replacing the old subtree
<pippijn>
with an ambiguous language like C++, you get interesting challenges
<pippijn>
because one change can change the entire parse
<pippijn>
and you don't want to re-parse everything
<pippijn>
so, you produce an ambiguous parse forest to begin with
<pippijn>
with every possible parse in it
<pippijn>
then, you store the current path along with the forest
<pippijn>
the currently valid path according to the type information
<pippijn>
this is important for real time parsing in text editors
<pippijn>
ok, I found it
<pippijn>
Harmonia project
<pippijn>
incremental parsing and semantic analysis
<pippijn>
"Harmonia can be used to augment text editors to robustly support the language-aware editing and navigation of documents, including those that are malformed, incomplete, or inconsistent (i.e. the document can remain in that state indefinitely)."
<pippijn>
I worked on this some years ago
<pippijn>
I might have the code lying around somewhere..
zpe has quit [Ping timeout: 256 seconds]
<companion_cube>
sorry if I broke you heart by my ignorance :p
<pippijn>
hehe
<companion_cube>
so, I'll use "push parser" from now on
<pippijn>
I don't know if that is the correct terminology
<pippijn>
"(The current push parsing interface is experimental and may evolve. More user feedback will help to stabilize it.)"
<pippijn>
yeah, and it has been for years
skchrko_ has quit [Quit: Leaving]
<pippijn>
companion_cube: so, how do you do the push parser?
<companion_cube>
by hand, with a stack
<pippijn>
ok
<pippijn>
too bad
<companion_cube>
it still has room for optimization in its current form
<companion_cube>
I could have used continuations ^^
<pippijn>
maybe I'll add a push parser interface to my parser generator
<pippijn>
not so hard
<pippijn>
actually very easy
<companion_cube>
I think stacks are efficient for this
<companion_cube>
the nice thing with B-encode is that parsing strings is very lean
<pippijn>
I don't see how you can do parsing without a stack
<pippijn>
if it were a pull parser, you'd have a stack, too
<pippijn>
if the language is not regular, you need a stack
<pippijn>
push-down automaton
<pippijn>
regular languages can be parsed with a deterministic finite automaton
mye has quit [Quit: mye]
<pippijn>
that doesn't have a stack
<pippijn>
but CFGs need a stack
<pippijn>
and bencode is context-free, not regular
<pippijn>
because you can nest stuff arbitrarily
<pippijn>
so either way, you need a stack :)
<pippijn>
companion_cube: how would you parse it without a stack?
<mrvn>
pippijn: with a lifo queue
<pippijn>
mrvn: ah?
<mrvn>
with continuations
<pippijn>
ah yes
<pippijn>
ok :)
<whitequark>
pippijn: your projects are hard to use without your build system.
<pippijn>
are they?
<pippijn>
because the build system is new
<pippijn>
before that, I had ocamlbuild and oasis
<pippijn>
I didn't change the code
<pippijn>
and they worked fine before
<whitequark>
sure, I didn't either
<ousado>
.. and one more thing regarding text vs binary, just think about what useful stuff could be done with the amount of energy wasted for all the cycles required to parse http
<whitequark>
but it's a pain to integrate into something other than obuild
<pippijn>
whitequark: I can't believe that
<whitequark>
ousado: nothing?
<pippijn>
what makes it painful?
<whitequark>
ousado: the only valid reason against textual HTTP I can think of, is on-write byte amount... which only even matters due to mobile, today.
<whitequark>
pippijn: well, I had to rewrite all build rules in ocamlbuild
<pippijn>
all?
<pippijn>
like
<pippijn>
one?
<ousado>
well..
<pippijn>
oh, maybe 2
<whitequark>
pippijn: three
<companion_cube>
pippijn: I mean, a hand-managed stack
<pippijn>
you should have told me before
<whitequark>
pippijn: you really should publish merr to opam
<pippijn>
omake has loads of obscure string functions like capitalize, html-string, ocaml-escaped, ...
<pippijn>
but no subst?
<whitequark>
html-string?
<pippijn>
I have no idea
jayprich has quit [Client Quit]
<pippijn>
The html-string function flattens a sequence into a single string, and escapes special HTML characters. This is similar to the concat function, but the elements are separated by whitespace. The result is treated as a unit; whitespace inside sequence elements is preserved literally.
<pippijn>
%.mlypack: %_parser.mlypack
<pippijn>
ln-or-cp $< $@
<pippijn>
problem solved
<pippijn>
whitequark: ok, you can rename the file at some point, and obuild will be ready for it