flux changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 4.00.1 http://bit.ly/UHeZyT | http://www.ocaml.org | Public logs at http://tunes.org/~nef/logs/ocaml/
<mrvn> pippijn: Do you know of any polling interface bindings that even have edge and level triggers?
<ousado> libevent
<mrvn> ousado: don't seem to be in debian
<mrvn> url?
travisbrady has quit [Quit: travisbrady]
<ousado> mrvn: you're asking for ocaml bindings?
<mrvn> yes
<whitequark> how does a string get converted from "..." form to the type format?
<whitequark> from literal form
<mrvn> whitequark: with compiler magic
<whitequark> mrvn: I need to tap this magic somehow :/
<whitequark> mrvn: in particular I need to either be able to provide a converter from my type (which internally is a string) to that format thingy
<whitequark> or, detect the context in the same way as compiler does, and don't perform the transformation I do
<mrvn> is it a string literal?
<whitequark> it is a string literal wrapped in an identity function which returns a type aliased to `string`.
<mrvn> file:///usr/share/doc/ocaml/docs/ocaml.html/libref/Pervasives.html#TYPEformat
<whitequark> yes, looking at that
UncleVasya has quit [Ping timeout: 248 seconds]
<mrvn> It's pretty evil
<whitequark> right
<whitequark> guess this isn't possible. hm. I have two options
<whitequark> either pattern-match the Printf functions, or check the string and refuse to automatically promote it to utf8s if it contains %'s
<mrvn> you have to convert the string literals to formats and then ^^ them together
<whitequark> well, the third one is to just patch this out of menhir
<mrvn> or parse the string and recreat it from format bits
<whitequark> that is the least sane part
<mrvn> biggest problem is the type
<whitequark> yeah, I understand the problem
<mrvn> if you have a variable string then the type won't be fixed and you are screwed
<whitequark> I guess I'll just check it for %'s
<mrvn> why not add a to-string function ?
<whitequark> oh?
<whitequark> see, I use camlp4 to automatically wrap all literals in a cast
<mrvn> do the pretty printing internally and return a string for the whole object.
ihm1 has joined #ocaml
<whitequark> and inside menhir, there's a Printf.printf, which explodes because of that
<whitequark> menhir-generated parser
dsheets has quit [Read error: Operation timed out]
<mrvn> oh, right. So Printf.printf "%s" "foo" won't work becuase "%s" becomes an UTF-16 thingy, right?
<whitequark> it's not even utf-16
<whitequark> it's type utf8s = private string.
<whitequark> since I want to avoid unnecessary conversion and my source is obviously in utf-8
<mrvn> same idea
<whitequark> yeah
<mrvn> good luck
<whitequark> I thought that it maybe can discern the type after ("%s" :> utf8s)
<whitequark> nope
<whitequark> mrvn: I'll just check if the string contains '%' in my preprocessor
<mrvn> That will quickly fail.
breakds has joined #ocaml
ashleyis has joined #ocaml
<whitequark> mrvn: why?
<whitequark> for printf-style literals, it is known that they contain '%'
<whitequark> and for all other literals, well, you'd have to convert it by hand... tough, sure
<mrvn> Printf.printf "%s\n" "You are in the top 3% of your class."
<whitequark> hmpf
<mrvn> you can check a bit more to see if the % is followed by a sensible char.
<mrvn> "% " is not a format string
<whitequark> yeah... I actually need to parse the thing and transform the consecutive arguments
<whitequark> by casting them back to string when necessary
<whitequark> that is... problematic. it for sure lies outside my camlp4 skillset/understanding.
<whitequark> wait, how Printf.printf "%s\n" "You are in the top 3% of your class." even parses?
<whitequark> or works
<whitequark> oh, I see
<mrvn> The compiler magically transforms the first into a format string because printf needs that type.
<whitequark> yeah, understood that part
<whitequark> was more interested in this:
<whitequark> utop # format_of_string "%s %s %s\n";;
<whitequark> - : (string -> string -> string -> '_a, '_b, '_c, '_d, '_d, '_a) format6 = <abstr>
<mrvn> And the format string contains a type part "string -> unit" that becomes the type of 'Printf.printf "%s\n"'
<mrvn> or string -> string -> string -> '_a in your case
<whitequark> `format' is so deeply evil.
<Drup> indeed
<Drup> there is a recent version with gadt that is very nice, but still need a bit of compiler magic
<mrvn> I want a sexp thing that uses GADTs
csakatoku has quit [Remote host closed the connection]
ben_zen has quit [Ping timeout: 256 seconds]
<whitequark> uh. no, it also breaks lexer tables.
<whitequark> I need a milder solution...
ben_zen has joined #ocaml
zpe has joined #ocaml
csakatoku has joined #ocaml
zpe has quit [Ping timeout: 260 seconds]
Arthur_ has joined #ocaml
osnr has quit [Quit: Leaving.]
Arthur__ has quit [Ping timeout: 245 seconds]
<whitequark> added another preprocessor; this one only touches expressions of form u"foo"
<whitequark> with some ocamlbuild trickery you can apply it to the lexer/parser selectively and they don't get broken.
<whitequark> could also use if you want printf, too.
<whitequark> somewhat convoluted but it works.
Arthur_ has quit [Read error: No route to host]
Arthur has joined #ocaml
Arthur is now known as Guest7916
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
ygrek has joined #ocaml
<whitequark> hm, I break pattern matching...
travisbrady has joined #ocaml
madroach has quit [Ping timeout: 248 seconds]
madroach has joined #ocaml
<ygrek> Drup, so we can observe the pattern that lazy lists lose to generators, not unexpected :)
<Drup> ygrek: Seq is not exactly a generator and I think the results are very specific to my application.
<Drup> However, I'm still not sure why BatEnum is loosing so clearly against BatSeq
<Drup> except "Ocaml's compiler is very very good with closures"
emmanuelux has quit [Remote host closed the connection]
q66 has quit [Quit: Leaving]
zpe has joined #ocaml
zpe has quit [Ping timeout: 260 seconds]
<whitequark> pippijn: your validate_utf8s is missing an assertion... add assert (i + length < (String.length s));
<whitequark> before the loop
introom has joined #ocaml
zpe has joined #ocaml
zpe has quit [Ping timeout: 268 seconds]
darkf has joined #ocaml
travisbrady has quit [Quit: travisbrady]
<whitequark> uh, how do I use menhir with non-Lexing lexbuffer?
<whitequark> and thus lexer
<whitequark> hm, seems like I need a "recent" menhir
<whitequark> figured it out
breakds has quit [Quit: Konversation terminated!]
osnr1 has joined #ocaml
osnr has quit [Read error: Connection reset by peer]
osnr1 has left #ocaml []
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
ihm1 has quit [Quit: ihm1]
zpe has joined #ocaml
zpe has quit [Ping timeout: 268 seconds]
talzeus is now known as ioerror
ioerror is now known as Guest27900
Guest27900 is now known as talzeus
csakatok_ has joined #ocaml
csakatoku has quit [Ping timeout: 246 seconds]
ggole has joined #ocaml
Drup has quit [Quit: Leaving.]
osnr has quit [Quit: Leaving.]
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
pootler has quit [Ping timeout: 240 seconds]
osa1 has quit [Ping timeout: 240 seconds]
justdit has joined #ocaml
osnr has quit [Quit: Leaving.]
gnuvince has quit [Remote host closed the connection]
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
ben_zen has quit [Ping timeout: 246 seconds]
osa1 has joined #ocaml
mye has joined #ocaml
mye has quit [Client Quit]
osa1 has quit [Client Quit]
osa1 has joined #ocaml
ben_zen has joined #ocaml
gnuvince has joined #ocaml
zpe has joined #ocaml
derek_c has joined #ocaml
zpe has quit [Ping timeout: 246 seconds]
csakatoku has joined #ocaml
csakatok_ has quit [Ping timeout: 246 seconds]
osnr has quit [Quit: Leaving.]
ygrek has quit [Ping timeout: 268 seconds]
derek_c has quit [Quit: leaving]
pkrnj has joined #ocaml
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
pootler has joined #ocaml
pkrnj has quit [Quit: Textual IRC Client: www.textualapp.com]
Guest7916 has quit [Ping timeout: 252 seconds]
Simn has joined #ocaml
osnr has quit [Quit: Leaving.]
ygrek has joined #ocaml
zpe has joined #ocaml
thedoc has joined #ocaml
zpe has quit [Ping timeout: 260 seconds]
<thedoc> hey whats new
thedoc has quit [Client Quit]
thedoc has joined #ocaml
<thedoc> hey
Yoric has joined #ocaml
ontologiae has joined #ocaml
doc02cam has joined #ocaml
thedoc has quit [Ping timeout: 246 seconds]
doc02cam has quit [Client Quit]
thedoc has joined #ocaml
domsj has quit [Ping timeout: 264 seconds]
doc02cam has joined #ocaml
doc02cam has quit [Client Quit]
doc02cam has joined #ocaml
ben_zen has quit [Ping timeout: 240 seconds]
thedoc has quit [Ping timeout: 256 seconds]
cago has joined #ocaml
Arthur has joined #ocaml
Arthur is now known as Guest42040
ontologiae has quit [Ping timeout: 246 seconds]
pootler has quit [Ping timeout: 268 seconds]
Yoric has quit [Ping timeout: 252 seconds]
thedoc has joined #ocaml
doc02cam has quit [Ping timeout: 260 seconds]
thedoc has quit [Client Quit]
osa1 has quit [Quit: Konversation terminated!]
<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
<shepard`> ok, thank you for the hints :-)
<thomasga> module L = module type of List
<thomasga> let x = (module List: L)
<thomasga> and then you can pass x around
avsm has joined #ocaml
Simn has quit [Quit: Leaving]
breakds has joined #ocaml
<mrvn> module type L = sig val l : 'a list end
<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
<jdoles> Very funny
amiller_ is now known as amiller
amiller has quit [Changing host]
amiller has joined #ocaml
ttamttam has quit [Quit: ttamttam]
<whitequark> pippijn: I can't build merr
<whitequark> does it depend on itself?
osnr has quit [Quit: Leaving.]
<pippijn> whitequark: yes, but.. https://paste.xinu.at/LHr0N1/
<pippijn> you can use the stub at the bottom
<whitequark> use common::sense; LOL
<whitequark> is this an actual perl module?
<pippijn> yeah
<whitequark> ok
<pippijn> but it's not necessary
<whitequark> so I put the stub below in the e_tokens.ml, right?
<pippijn> so if you don't have it, comment it out
<pippijn> no
<pippijn> e_errors.ml
<adrien_oww> jdoles: oh, I bet Mandrake 9.1 was more advanced than *bsd and mac os x currently are :-)
<whitequark> so uh... where do I get e_tokens.ml?
<pippijn> from menhir
<pippijn> --only-tokens
<whitequark> oh, I see
<whitequark> thanks
<pippijn> and then the grammar with --external-tokens E_tokens
cago has joined #ocaml
<pippijn> look at obuild/codegen/merr.om, if you still have it
cago has left #ocaml []
<pippijn> using merr with obuild has strict usage pattern requirements
<pippijn> which is good for me, I like to force myself into conventions
<Drup> jdoles: it compiles fine on my arch, for OS X, read this : https://github.com/Drup/LILiS#building-lablgtk-and-cairo-on-os-x
remyzorg has quit [Ping timeout: 246 seconds]
pootler has quit [Ping timeout: 240 seconds]
remyzorg has joined #ocaml
pootler has joined #ocaml
pootler_ has quit [Ping timeout: 270 seconds]
pootler_ has joined #ocaml
<wmeyer> ping adrien :>
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
<adrien> reduced staff, reduced everything, moving targets
<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
<travisbrady> avsm: is there an opam compiler switch for jocaml? This issue indicates there is: https://github.com/OCamlPro/opam-repository/issues/62 but I don't see it in /compilers on github
<wmeyer> pippijn: good point
<wmeyer> I like Mlton
<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
<ousado> lol
<companion_cube> really
<ousado> yes
<mrvn> B-encode iirc isn't length prefixed
<ousado> but who would be crazy enough to do that
<companion_cube> mrvn: strings are
<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
<companion_cube> hmmmmmm
<pippijn> seems dead
<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> bison uses it in its documentation
<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> whitequark: 2) https://paste.xinu.at/MhqZ/
<whitequark> pippijn: oh no, that's three rules for building merr itself
<whitequark> which I wrote
<whitequark> I didn't integrate it into my compiler yet
<pippijn> and flag ["ocaml"; "menhir"; "dump"] & S[A"--dump"];
* whitequark nods
<ousado> whitequark: so you think no energy is wasted because http is inefficient?
<whitequark> ousado: I think it doesn't matter
<ousado> aha
<ousado> great
<whitequark> energy exists to be wasted, ultimately
<pippijn> whitequark: https://paste.xinu.at/kRPtTB/
<whitequark> think about it: everything your computer consumes, it turns into heat
<whitequark> and almost everything, directly.
introom has joined #ocaml
<whitequark> pippijn: http://pastie.org/8122327 what I got
<whitequark> well, thanks either way
<whitequark> ousado: by this logic, you also need to forbid all interpreted/JITed languages
<whitequark> and so on
introom has quit [Ping timeout: 240 seconds]
<whitequark> pippijn: btw, why does merr even require this sed preprocessing?
<whitequark> since you have a fork of menhir you could just as well extend the grammar
<pippijn> whitequark: yes
<whitequark> in fact this is exactly what I am going to do
<pippijn> feel free to do that
<pippijn> I didn't want to change too much, so I stay close to upstream
<whitequark> it's not that complex?
UncleVasya has quit [Read error: Connection reset by peer]
<pippijn> it's very simple
<whitequark> and, uh, why don't integrate both changes upstream
<whitequark> they seem rather benign
<pippijn> keep in mind that 1) I did these things when I had only worked with ocaml for 2 weeks
<pippijn> and I hadn't seen a functional programming language before
<pippijn> so I didn't feel very comfortable mucking around in menhir
<whitequark> I see
<pippijn> and 2) I sent the patches upstream
<pippijn> once last year
<pippijn> and once a few weeks ago
<pippijn> nothing happens
<pippijn> I want to generate a name_of_token function in menhir, directly
<pippijn> as part of the external tokens
<pippijn> but I'm not doing much with menhir, these days
<pippijn> I wrote my own parser generator
<pippijn> (menhir is better)
<whitequark> I see
<whitequark> btw, I think I did interesting things with your ucslib
<pippijn> nice
<pippijn> what did you do?
<whitequark> I added a preprocessor which wraps all string literals with a function which converts them to utf8s
<whitequark> and an overlay over stdlib, which you can invoke with `open Unicode.Std`
<pippijn> interesting
<pippijn> Unicode = Ucs?
<whitequark> yes, it's your Unicode module from ucs
<pippijn> oh
<pippijn> okay, nice
<pippijn> I think I'll change the internal representation to string for everything
<pippijn> I like using lists, though :)
<whitequark> so it fixes stuff like int_of_string, and so on. also has an overlay over String/Char
<whitequark> the only thing which is currently broken is pattern matching
<whitequark> the preprocessor should detect matches of string literals and somehow make it work
<whitequark> dunno how, yet
<pippijn> whitequark: I do
<whitequark> pippijn: I think I should tidy it up and publish
<mrvn> making strings utf-8 is easy. But how do you keep format strings as format?
<pippijn> | TyCon (blah, _, u8"hello") -> blah ...
<whitequark> mrvn: I don't
<whitequark> if you want to use format strings, disable the preprocessor for that module, and do u"str" manually
<pippijn> =>
<pippijn> | TyCon (blah, _, tmp_s1) when eq_utf8s_s tmp_s1 "hello" -> blah ...
<pippijn> or something :)
<pippijn> or
<mrvn> why not add a b"str" for non utf-8 strings?
<mrvn> like python
<pippijn> | TyCon (blah, _, tmp_s1) when tmp_s1 = adopt_utf8s "hello" -> blah ...
<whitequark> mrvn: that would be l1"str"
<whitequark> since regular ocaml strings are explicitly latin-1
<whitequark> pippijn: yes, makes sense
<ousado> whitequark: who's talking about forbidding anything?
<whitequark> ousado: oh, you don't. good
<mrvn> Fatal error: exception Invalid_argument("Thread.kill: not implemented")
<mrvn> :(
mcclurmc has joined #ocaml
<companion_cube> use Lwt!
<mrvn> for 2 threads?
<pippijn> yes
<pippijn> haha
<pippijn> mrvn: no, not you
<pippijn> but why do you use threads?
<pippijn> I thought you were making a network lib
UncleVasya has joined #ocaml
<companion_cube> Lwt!
<mrvn> because SDL can't poll a socket in its event loop
<pippijn> SDL?
<pippijn> are you using sdl network?
<mrvn> no
<mrvn> pippijn: does sdl have networking stuff? Doesn't seem to have a ocaml module.
<pippijn> sdl_network
<pippijn> ah no
<pippijn> sdl_net
<whitequark> menhir has five lexers?!
<whitequark> and four parsers
<mrvn> pippijn: 1.2 or 2.0?
<pippijn> 1.2
<mrvn> do you know of any bindings for that?
<pippijn> I don't know
<mrvn> pippijn: There doesn't seem to be anything in SDL_net that avoids having one thread for network and one for gui
<pippijn> sure
<pippijn> oh
<pippijn> sorry, misread
zpe has joined #ocaml
<pippijn> mrvn: too bad
eni has quit [Quit: Leaving]
zpe has quit [Ping timeout: 256 seconds]
malo has quit [Quit: Leaving]
<pippijn> why the whitespace changes?
<whitequark> uh. editor settings
<whitequark> I can remove them.
<pippijn> are you trying to make merging upstream harder?
<pippijn> ok
<whitequark> updated.
<pippijn> ok, looks good
<pippijn> how do you accept a pull request?
<whitequark> there's a button
<whitequark> "Merge" :)
<pippijn> ah
<pippijn> apparently it didn't log me in the first time I logged in..
jayprich has quit [Ping timeout: 256 seconds]
<pippijn> nice
<whitequark> awesome, thanks
<whitequark> now I want to simplify merr rules, and its own build as well
<pippijn> whitequark: this change is not too much
<pippijn> replaying these changes back onto new upstream releases won't be painful
* whitequark nods
<pippijn> simplify merr rules?
<whitequark> build rules
<pippijn> ah
<whitequark> I could get rid of the sed step
<pippijn> yes, now you can
<whitequark> also, do you specifically want your parser to be built in two separate parts?
<pippijn> no
demonimin has quit [Ping timeout: 252 seconds]
<pippijn> well, in merr I do that
<pippijn> and in everything else, I do that
<pippijn> and I like it
<pippijn> but you don't need to do that for your own parser
<whitequark> I see
<pippijn> merr will stop looking at the grammar file when it sees %%
<pippijn> when collecting token names
<pippijn> whitequark: I like splitting tokens and parser
<pippijn> that way, the lexer does not directly depend on the parser
<pippijn> I don't like the feeling of that
alang_ has joined #ocaml
<whitequark> pippijn: yes, that makes sense
wmeyer has quit [Ping timeout: 264 seconds]
<pippijn> they are both consumers of the type "token"
<pippijn> one produces instances, the other consumes them
<pippijn> and the lexer can be used independently
Drup has joined #ocaml
<pippijn> better for code reuse
<pippijn> I think merr also has 3 parsers
<pippijn> one for the token names, one for code fragments, and one for the parser.automaton
mcclurmc has quit [Ping timeout: 268 seconds]
<whitequark> I see two
<pippijn> ok, I don't remember clearly
<whitequark> by the way, how do you tell ocamlbuild to do that --external-tokens trick?
<pippijn> since I didn't know how to make parameterised tags
<pippijn> I had a ext_ctokens for the C tokens
<pippijn> an*
<pippijn> but you can make a parameterised one
<pippijn> actually I forgot how to do that now
<pippijn> something that accepts ext_tokens(E_tokens)
<whitequark> I'll figure it out
eikke has quit [Ping timeout: 276 seconds]
<whitequark> would you mind if I include build rules for ocamlbuild in merr as well?
<pippijn> hmm
<pippijn> you #use those, then?
<whitequark> I'll just write a script which recurs into merr and builds it
<whitequark> that's what I have for menhir
<pippijn> oh
<whitequark> well, that script would be in my own tree
<pippijn> alright
<whitequark> and merr would be just a submodule
<pippijn> I don't mind
<whitequark> nice
<pippijn> it would help going towards opam packaging
<whitequark> one thing, though. ocamlbuild wants to transform e.mlypack to e.ml, and obuild seems to do e.mlypack -> e_parser.ml
<pippijn> I made obuild specifically to have *everything* built together
<pippijn> whitequark: I see
<pippijn> whitequark: make it e_parser.mlypack
<pippijn> I'll change obuild
<whitequark> ok, good
eikke has joined #ocaml
<whitequark> and yeah, opam is where this should ideally reside
<pippijn> actually
<whitequark> maybe even package your modified menhir... so it will be merr and merr-menhir
<whitequark> that would be really easy to use
smondet has quit [Quit: Bye]
<pippijn> the e.mlypack was a failed attempt to unify %_tokens.ml{,i} and %_parser.ml{,i}
<pippijn> and since it failed, it might as well be e_parser again (as it was before)
<pippijn> oh wait, I do need it here
<pippijn> I can't believe omake doesn't have a simple string substitution function
<whitequark> since it's a 2 line file, I think we can just have a copy of it
<pippijn> I don't want a copy
<pippijn> well, not one in the source tree
<pippijn> I can copy it as part of the build
jayprich has joined #ocaml
<pippijn> % echo $(replacesuffixes _hoo, _moo, boo_hoo)
<pippijn> boo_hoo
<pippijn> doesn't work
<pippijn> gnu make has a patsubst
demonimin has joined #ocaml
<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
<pippijn> oh dear
<pippijn> omake goes crazy
<whitequark> ow
<pippijn> I'm not happy: https://paste.xinu.at/p3C/
<pippijn> but it works
jonafan has quit [Remote host closed the connection]
jonafan has joined #ocaml
<pippijn> whitequark: I pushed the move
<whitequark> pippijn: ok... I've almost finished adding ocamlbuild rules
<pippijn> are you going to do anything with json?
<whitequark> maybe
<whitequark> json is everywhere these days
<pippijn> not super useful
<pippijn> but maybe a little
ollehar has quit [Ping timeout: 276 seconds]
<whitequark> oh neat, json quasiquotation
<pippijn> yep
<whitequark> I like it.
<pippijn> for yojson
<whitequark> even matching
<pippijn> of course
<pippijn> I use it mainly for matching :)
<pippijn> I use the ocaml lexer, no own json lexer
<pippijn> so the quotations are not correct json
Snark has quit [Ping timeout: 256 seconds]
<pippijn> | <:json<["capabilities" .. $args$]>> ->
<pippijn> the .. means "the rest of the list"
<pippijn> maybe that should be ::
gasche has quit [Ping timeout: 248 seconds]
<pippijn> [.. $update$]
<pippijn> means update is the whole list
<whitequark> why'd you need [] around it at all?
<whitequark> <:json<$update$>>
<pippijn> then how do you know what it is?
<pippijn> json list, object, string?
<pippijn> for it to be valid json, it will be object or list, yes
<pippijn> well, which one is it?
<whitequark> look at its type?
<whitequark> oh, ocaml can't do that
<whitequark> I see.
<pippijn> camlp4 can't
<pippijn> and
<pippijn> ocaml can't do that, either :)
<whitequark> yea
<pippijn> because it's decided at runtime
<whitequark> the type is?
<pippijn> the tycon is
<pippijn> the type is "json"
<whitequark> hmm
<pippijn> that can be JsonObject or JsonArray or something
<whitequark> right, you need that in matching
zpe has joined #ocaml
osnr has quit [Quit: Leaving.]
gasche has joined #ocaml
zpe has quit [Ping timeout: 264 seconds]
<whitequark> pippijn: "Failure: %"
<whitequark> very informative.
travisbrady has quit [Quit: travisbrady]
Yoric has quit [Ping timeout: 260 seconds]
UncleVasya has quit [Remote host closed the connection]
<pippijn> whitequark: :\
<pippijn> whitequark: yeah, I didn't put a lot of effort into usability of merr
<whitequark> I'll fix that
<pippijn> whitequark: because I made the tool just for myself, and my goal was to make a C parser, not a parser generator + helper tools
pootler_ has quit [Quit: Lost terminal]
pootler has quit [Quit: Lost terminal]
pootler has joined #ocaml
<pippijn> so I would have made it in sed(1) if I could
<pippijn> just whatever gets the job done quickly
<whitequark> it's written pretty good for a quick&dirty job
demonimin_ has joined #ocaml
<pippijn> I would do a lot of things differently, now
<whitequark> I think you wanted to improve it?
<whitequark> I'd help with that
<pippijn> yes
<whitequark> if I can
<pippijn> if you have any ideas, you can write them down
<whitequark> I don't quite like how libmerr is written, now
<pippijn> me neither
<whitequark> but I need to play with it to understand how to improve it
demonimin has quit [Ping timeout: 260 seconds]
<whitequark> hahaha, your error messages are excellent
<whitequark> clang :D
<pippijn> huh?
<whitequark> colored and formatted like clang's ones
<pippijn> oh, yeah
<pippijn> :)
<whitequark> ok. so it bootstraps and works
<pippijn> can you generate merr's own e_errors.ml?
eikke has quit [Ping timeout: 248 seconds]
<whitequark> yes, that's what I called bootstrapping
<pippijn> good
<whitequark> and I verified that it actually works, too.
eikke has joined #ocaml
<pippijn> by the way, the ocamlbuild thing will be 2 files, right?
<pippijn> /myocamlbuild.ml and /_tags
<whitequark> yep
<pippijn> good
<whitequark> also .gitignore
<pippijn> that's fine
<pippijn> I am beginning to seriously dislike omake
<pippijn> when things work, it's brilliant
<pippijn> but I simply don't understand how it works
<pippijn> I have a configure function for C projects that has this line:
<pippijn> # All target scanners at least depend on the local headers.
<pippijn> .SCANNER: scan-c-%: $(Headers)
<pippijn> that makes sure that all headers are there when omake scans C files for header dependencies
<pippijn> but it doesn't work
<pippijn> it's ignored
tobiasBora has joined #ocaml
<pippijn> not ignored, but forgotten
<whitequark> hmpf. I would want to provide the rules for *using* merr as an ocamlbuild plugin
<whitequark> but I have no clue how to do that...
<whitequark> oh by copy-paste. excellent
<pippijn> whitequark: make a function merr_rule
<pippijn> that people can call in their myocamlbuild.ml to produce a rule for their parser
<pippijn> unless you can make things work with % somehow
eikke has quit [Ping timeout: 264 seconds]
<pippijn> maybe you can
<whitequark> % ?
<pippijn> %.automaton and such
<whitequark> ah
<whitequark> I did already
<pippijn> hm
<pippijn> I don't agree with your whitespace policy
<whitequark> huh?
<pippijn> do you write matches like this:
<pippijn> match foo with
<pippijn> | blah ->
<whitequark> yes
<pippijn> code code code
<pippijn> because I write it like
<pippijn> | blah ->
<pippijn> code code code
<whitequark> ok I'll fix that
<pippijn> whitequark: you really write it like that?
<whitequark> yes
<pippijn> hmm
<whitequark> also fixed
<pippijn> it's my way in menhir
<pippijn> and in every other code I've seen so far
tobiasBora has quit [Quit: Konversation terminated!]
<pippijn> huh
watermind has joined #ocaml
<pippijn> oh, you changed myocamlbuild
<pippijn> I was talking about the lexer
<whitequark> oh.
<whitequark> sure
<pippijn> I don't care about myocamlbuild
<pippijn> though I would indent the whole | block by another 2 spaces
<pippijn> including the |
<pippijn> but that's just me
<pippijn> I don't care
<pippijn> interesting
<pippijn> I have changed my style
<pippijn> rule token = parse
<pippijn> | "accept"
<pippijn> this is now my lexer style, but only for lexers, not for regular code
<pippijn> maybe I should go back to the original 2-space indented style.. may be more consistent
eikke has joined #ocaml
<whitequark> pippijn: updated
<pippijn> whitequark: you can infer MERR_BOOTSTRAP from the fact that merr.native or merr.byte exists
<whitequark> right
<whitequark> but I feel that it's better to require it explicitly
<pippijn> what happened here?
<whitequark> or maybe not
<whitequark> there was a tab.
<pippijn> oh
<pippijn> alright
<whitequark> lemme fix MERR_BOOTSTRAP
<pippijn> ok
<pippijn> oh yeah, pflag, that was it :)
<pippijn> I don't quite understand why you would use a different name for external-tokens
<pippijn> what's wrong with external_tokens?
<whitequark> oh, that was a failed experiment
<whitequark> should fix it
<pippijn> I like that you added something to the readme
<whitequark> hm, how should I check for host merr existence?..
<whitequark> try to execute merr.native?
<whitequark> not sure
<pippijn> no
<pippijn> you could, I think, because merr with no arguments probably does nothing
<whitequark> ./merr.native -help
<whitequark> of course
<whitequark> and check for the status
<pippijn> or that
<pippijn> yes
<pippijn> or stat
<whitequark> well, executing it checks that it actually works
<pippijn> Sys.file_exists
<pippijn> ok
<pippijn> up to you :)
<pippijn> you could do: List.find try_exec_merr ["./merr.native"; "merr"] or something
<pippijn> to find it in path
<whitequark> yes, makes sense
demonimin_ is now known as demonimin
thomasga has quit [Quit: Leaving.]
<whitequark> pippijn: done
<pippijn> perfect
<pippijn> yeah
<pippijn> could almost have been written by me ;)
<whitequark> almost? :D
<pippijn> just some style differences
<pippijn> but it's fine
<whitequark> ah
* pippijn pulls
troydm has quit [Ping timeout: 248 seconds]
osa1 has quit [Ping timeout: 260 seconds]
<whitequark> uh. turns out i have a LOT of tokens
<pippijn> hm?
<whitequark> merr requires to write them each on its own line
<pippijn> oh
<pippijn> well, yeah
<whitequark> so I realized that I have a hell of a lot of tokens
<pippijn> maybe you can just not pass -t
<pippijn> might work, I don't know
<pippijn> I forgot
<pippijn> I think I made automerr (with the automaton parser) optional
<pippijn> hm
<pippijn> gpg: skipped "0x635D0E0A": unusable secret key
<pippijn> did my key expire already? :\
eikke has quit [Ping timeout: 246 seconds]
<pippijn> a year passes quickly
<pippijn> I found out what causes my problem with the scanner
troydm has joined #ocaml
<pippijn> omake keeps surprising me
<pippijn> and not in a good way
<pippijn> I've been spamming the mailing list
<pippijn> hopefully it will help people who are surprised by similar problems
travisbrady has joined #ocaml