gildor changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 3.12.1 http://bit.ly/nNVIVH
ankit9 has quit [Ping timeout: 245 seconds]
ankit9 has joined #ocaml
ulfdoz_ has joined #ocaml
ulfdoz has quit [Ping timeout: 246 seconds]
ulfdoz_ is now known as ulfdoz
mort___ has quit [Quit: Leaving.]
sepp2k1 has quit [Read error: Connection reset by peer]
avsm1 has joined #ocaml
avsm has quit [Ping timeout: 246 seconds]
gnuvince has joined #ocaml
iago has quit [Quit: Leaving]
mjonsson has joined #ocaml
gnuvince has quit [Ping timeout: 245 seconds]
avsm1 has quit [Quit: Leaving.]
tbrady has quit [Quit: tbrady]
emmanuelux has quit [Ping timeout: 255 seconds]
cdidd has joined #ocaml
cdidd has quit [Quit: Leaving]
cdidd has joined #ocaml
ankit9 has quit [Ping timeout: 264 seconds]
ankit9 has joined #ocaml
mjonsson has quit [Quit: Leaving]
ankit9 has quit [Ping timeout: 245 seconds]
ankit9 has joined #ocaml
joewilliams has quit [Ping timeout: 244 seconds]
lopex has quit [Ping timeout: 265 seconds]
lopex has joined #ocaml
EmmanuelOga has joined #ocaml
eni has joined #ocaml
mehitabel has left #ocaml []
Anarchos has joined #ocaml
edwin has joined #ocaml
silver has joined #ocaml
eni has quit [Quit: Leaving]
mort___ has joined #ocaml
Ptival has quit [Quit: Lost terminal]
Anarchos has quit [Quit: Vision[0.9.7-H-090423]: i've been blurred!]
thelema has joined #ocaml
thelema_ has quit [Read error: Operation timed out]
cdidd has quit [Quit: Leaving]
cdidd has joined #ocaml
ankit9 has quit [Ping timeout: 264 seconds]
gasche_ has joined #ocaml
ankit9 has joined #ocaml
ankit9 has quit [Quit: Leaving]
cdidd has quit [Ping timeout: 246 seconds]
Oejet has joined #ocaml
EmmanuelOga has quit [Ping timeout: 244 seconds]
xcombelle has joined #ocaml
<adrien> gasche_: wrt compiler-libs, I'm all for not bothering with compat for 4.00: the current state is crap, no point in trying to keep it somehow alive while releasing a new major version
<gasche_> thanks for your support :)
avsm has joined #ocaml
Hussaind has joined #ocaml
Hussaind has left #ocaml []
ulfdoz has quit [Ping timeout: 246 seconds]
ulfdoz has joined #ocaml
edwin has left #ocaml []
wandernauta has joined #ocaml
Snark has joined #ocaml
netrino_ has joined #ocaml
<gasche_> I'm hoping to secure some time to hack on ocamlbuild this summer (and Batteries, of course, but that is another story)
<gasche_> if you have recurring concerns or solid feature wishes, please make sure they are on the Caml bugtracker in the OCamlbuild category
<gasche_> ah, and if you want to lend a hand, implementing features and submitting patch, you're more than welcome
<gasche_> s/patch/patches/
<gasche_> (OCamlbuild's code has a very distinctive look&feel from the rest of the compiler; no previous experience with the compiler internals is needed, even though you may learn things about the compilation and linking model that you maybe didn't want to know)
sepp2k has joined #ocaml
Ptival has joined #ocaml
<avsm> there is no default rule to invoke ocamlmklib from ocamlbuild is there?
* avsm discovers the .clib file
BiDOrD_ has quit [Remote host closed the connection]
BiDOrD has joined #ocaml
<gasche_> thelema, given the Hashtbl change between 3.12 and 4.00, we have have to reconsider some of BatHashtbl's design choice
<gasche_> (currently, it copies some of the 3.12 implementation; it would keep working under 4.00, but use the old hashing algorithm, which means that using a BatHashtbl table through Hashtbl will be fine but not the converse)
<avsm> hrm, I'm using ocamlmklib to build a C binding and library in a lib/ subdirectory
<avsm> i want -cclib -lfoo to be part of the .cmxa archive, but i also currently need to pass -ccopt -Llib, and that also gets encoded
<avsm> what's the correct way to build a C binding in a subdirectory and have it picked up for the compile, but not actually get recorded in the archive (as the file will be installed in stublibs/)
<gasche_> rwmjones, I'll be interested in some details about how ocaml-sexplib is affected by -compiler-libs
BiDOrD has quit [Read error: Operation timed out]
BiDOrD has joined #ocaml
milosn has quit [Read error: No route to host]
milosn has joined #ocaml
err404 has joined #ocaml
<avsm> ah, it only goes wrong for .cmxs building, not for .cmxa
Anarchos has joined #ocaml
mfp has quit [Ping timeout: 264 seconds]
mfp has joined #ocaml
err404 has quit [Read error: No route to host]
gnuvince has joined #ocaml
Ptival has quit [Read error: Connection reset by peer]
Ptival has joined #ocaml
<thelema> gasche_: I'm at the point where I need to implement the 4.00 seeded hash function under 3.12
<thelema> I've pulled the 4.0 hashtbl implementation into bathashtbl, but still need to deal with the need for the seeded hash under 3.12
<gasche_> thelema, when you say "I need", is this because of the security rattle done around non-randomized hash table, or for an other reason?
<thelema> It's not to scratch my personal itch, but that some implementation needs to be provided for this function under 3.12 in order to successfully backport the 4.0 hashtbl to 3.12
<gasche_> but do we need to do that?
<thelema> well, I have the most trivial patch to make batteries compile under 4.00 written (not sure if I pushed it)
<gasche_> we could try instead to arrange so that 3.12 Batteries users observe a BatHashtbl implementation compatible with OCaml 3.12, and 4.00 with 4.00
<thelema> That's another possibility.
<thelema> Since the change in API isn't really that much, I figured it'd be easier to just have one implementation for both
<gasche_> (we could also provide *both* implementations under both versions, if that's what you're aiming to, and that would be useful in some contexts, eg. 3.12 users working on dumps / output_value produced by 4.00 users; but that is a messy scenario)
<thelema> we'll have to have some sort of conditional compilation anyway to detect the ocaml version and use the right code
<gasche_> I'm not sure, because the internal representation of hash table changed
<thelema> I don't plan on providing both, as the 4.00 already has backwards compatibility checks to deal with 3.12 dumps
<gasche_> precisely
<gasche_> we could use those checks to decide which implementation to use on any given hashtable
<gasche_> hm
<gasche_> we would still need to decide which format to use when creating new hash tables
<thelema> true, but in order to compile code that uses the seeded hash under 3.12, we have to provide a seeded hash function, as ocaml wouldn't provide us one
<gasche_> agreed
<thelema> I guess we could have a Hashtbl.make312
<thelema> to make old-format hash tables
<thelema> although this is a quite niche use case, I think
<gasche_> indeed
<gasche_> I need to think more about this
<thelema> but as I started with - the biggest issue is having a seeded hash under 3.12. I almost went the step to provide the 4.00 hash function written in ocaml...
<thelema> but stopped there, as that's kinda extreme
<gasche_> but I hoped we could find a way to get something reasonable without reimplementing or copying anything
<gasche_> (by being more abstract wrt. the Hashtbl implementation that we currently are)
<thelema> the alternative would be to ignore the seed and use the 3.12 hash function, losing all the added security under 3.12, despite it being in the interface
<thelema> we have to have access to the internals in order to provide the extra functions that we provide
<thelema> such as remove_all
gnuvince has quit [Ping timeout: 240 seconds]
wandernauta has left #ocaml []
BiDOrD has quit [Remote host closed the connection]
BiDOrD has joined #ocaml
BiDOrD_ has joined #ocaml
BiDOrD has quit [Ping timeout: 248 seconds]
BiDOrD_ has quit [Read error: Operation timed out]
BiDOrD has joined #ocaml
eni has joined #ocaml
silver has quit [Read error: Connection reset by peer]
tbrady has joined #ocaml
gnuvince has joined #ocaml
tbrady has quit [Client Quit]
avsm has quit [Quit: Leaving.]
avsm has joined #ocaml
hongboz has joined #ocaml
gnuvince has quit [Ping timeout: 255 seconds]
eni has quit [Ping timeout: 264 seconds]
<hongboz> Hi, all, Is there any neat trick to tell ocamlbuild always copy all .ml .mli files to _build?
<gasche_> doesn't asking it to build them work?
<adrien> it copies all the ones that are used; you want "find -name "*.mli" -o -name "*.ml" | xargs -I '{}' cp --parents '{}'" ?
<gasche_> (ocamlbuild foo.ml should copy foo.ml into _build)
<hongboz> gasche: the dependency is very complex
<hongboz> gasche: ocamlbuild is not that smart
<hongboz> adrien: yes. that's what I want, how to integrate it with ocamlbuild?
<adrien> if it's not smart enough to copy the files, it won't be smart enough to build them
<adrien> I wonder if ocamlbuild won't clean files from _build which it thinks aren't necessary anyway
<hongboz> adrien: not exactly, one example is when you use include
<adrien> I use include and it works for me so your issue
<adrien> must be more specific than that
<hongboz> adrien: I can specify the dependency in myocamlbuild.ml, but too many includes that I want to bother
<hongboz> don't sorry
<adrien> hmm, hold on: when you say "include", you mean "include Module" which is standard ocaml, or you mean something used through a syntax extension à la C's #include?
<hongboz> #include
<adrien> ah, ok
<hongboz> And I wonder what's the bad thing if I always copy all source files into _build?
<adrien> if you copy them by hand, does it work or does ocamlbuild remove them?
BiDOrD has quit [Remote host closed the connection]
<hongboz> copy them by hand, sure it works
<hongboz> but when I edit it, I need to copy again
<avsm> hongboz: you need to flag the header files as dependencies, via a plugin
<avsm> hongboz: this is for building C?
<hongboz> avsm: Yes, but too many includes
<hongboz> avsm: No, I use #inlcude to share some code
<adrien> avsm: .ml and .mli files, so not C
<avsm> hongboz: ah, so you run through cpp and then ocamlc
* adrien doesn't know ocamlbuild well enough to help here
<hongboz> avsm: not exactly, my own defined macros :-)
<avsm> well, you can do this via a plugin. see http://brion.inria.fr/gallium/index.php/Compiling_C_with_gcc for an example of how to use the gcc dependency mechanism
<adrien> hongboz: but actually, do you have an example of your code?
<hongboz> adrien: suppose I have macros let f a b = << $a$ $b$ >> ;;
<hongboz> they are the same for expr, and patt
<hongboz> I use include to share them
<adrien> hongboz: well, I'm wondering why the standard module stuff isn't working for you ("open Module" or "include Module")
<hongboz> adrien: they depend on dynamic parser
<adrien> ok
<hongboz> why ocamlbuild not copy all .ml[i] files to _build?
<hongboz> Is there any bad thing about that?
<adrien> it doesn't need to
<adrien> so it skips doing it
<hongboz> adrien: Yes, not need to, but if do it, what's the bad thing? if not, I will a plugin to do it before I understand whether there's some bad effect?
<adrien> there shouldn't be any issues I guess
<avsm> hongboz: ocamlbuild dynamically discovers dependencies
<avsm> and with a plugin, you can register a rule which calls a function of (fun env builder -> cmd)
<avsm> the cmd is the build rule, but builder is a closure which can add *new* rules during the build
<avsm> so for example, you might parse a .mllib file, read every line, and add each one as a module that must be built before the rule can complete
<hongboz> avsm: as I said, there are too many includes for each file, write dep for every file is what I did before
<hongboz> but too painful
<hongboz> If only one or two includes, definitely I would just write dep in myocamlbuild.ml
<avsm> you can read them dynamically via ocaml code in the myocamlbuild...
<avsm> read how the .mllib works
<avsm> so if you have a file with your dependencies, you dont need to hardcode them in myocamlbuild
<hongboz> avsm: Your point is bunch them all together?
<hongboz> avsm: what's the difference from just copy all?
<hongboz> adrien: can you help a one line shell script to copy all files *.ml[i|l|y] to _build?
BiDOrD has joined #ocaml
<adrien> the one I wrote above _should_ work, but that's quite quick-and-dirty
<hongboz> adrien: it seems not exclude _build first?
<adrien> and the way it's written, it'll fail if you have spaces in paths, unless you rely on non-standard extensions (-print0 and -0)
<adrien> then insert a " | grep -v _build" in the chain
<adrien> (I need to check how to tell find to exclude paths)
BiDOrD has quit [Remote host closed the connection]
eni has joined #ocaml
cdidd has joined #ocaml
<avsm> putting files directly into _build is a little dangerous, since you bypass the digest mechanism. might work though
<avsm> why not just post-process them into another directory, and build that?
<hongboz> avsm: what do you mean post-process?
<hongboz> I will write `copy' in ocaml, but currently myocamlbuild.ml is already too long.
<hongboz> do you guys know it's possible that myocamlbuild accept several files instead of just one myocamlbuild.ml?
BiDOrD has joined #ocaml
<avsm> hongboz: i mean, do one build pass with a makefile that will output your .ml files without the #include, and then use ocamlbuild on those
<avsm> you cannot have multiple myocamlbuilds, unfortunately
<hongboz> avsm: Yes, it make sense, but I guess the error message will be messy
tbrady has joined #ocaml
<avsm> hongboz: you can preserve line numbers in generated ocaml code by outputing "#xxx" directives, just like in cpp
<avsm> starting to put together minimal ocamlbuild directories. comments on this C hello world binding are welcome... https://github.com/mirage/ocaml-build-skeleton/tree/master/examples/c_binding
<avsm> ocamlbuild is incredibly obscure, but starting to understand it i think
<adrien> I use oasis or ocamlmakefile for my C bindings; the fact that ocamlbuild didn't notice #include (and that it cannot differentiate between "foo.h" and "foo.c") made be avoid using ocamlbuild (directly)
<adrien> (I hadn't seen the link you gave earlier; I don't know if it already existed back then actually)
<hongboz> adrien: another thing is ocamlbuild is really slow
<adrien> for my webkit-gtk bindings, it goes at several dozens of elements a second; it really depends what you ask it to do
<adrien> (but it cannot build in parallel in general, yes)
gnuvince has joined #ocaml
tbrady has quit [Remote host closed the connection]
tbrady has joined #ocaml
mort___ has quit [Quit: Leaving.]
edwin has joined #ocaml
EmmanuelOga has joined #ocaml
xcombelle has quit [Quit: I am a manual virus, please copy me to your quit message.]
<hongboz> I solved problem by puring copy with a comparison on the modification time, it works pretty well :-)
<gasche_> I have considered using an #include macro in Batteries once, but finally did otherwise; cooperation with the rest of the language ecosystem (eg. ocamldoc) is too painful.
Submarine has joined #ocaml
<hongboz> gasche: I wrote .mli by hand
<hongboz> gasche: it makes me understand the code more well
<hongboz> In most cases, dump .inferred.mli, and copy to .mli
<avsm> adrien: i'm very tempted to switch back to ocamlmakefile. trying to remember why i ever switched away in the first place :)
<avsm> ah yes, parallel build.
<orbitz> I have been making my onw makefiles, it's greatfun! not htat hard with ocamlfind
<avsm> i actually want to stop using ocamlfind
<orbitz> Hw come/
<hongboz> avsm: why?
<avsm> i'm sick of all these layers slowing down my compiler time. oasis => ocamlfind => ocamlbuild => ocamlopt
<hongboz> yes. I remembered the old days that ocaml build really fast
<orbitz> avsm: For me it's make -> ocamlfind -> ocamlopt
<avsm> it still does; the tooling around it hasnt kept up. ocamlbuild + ocamlopt.opt is pretty good, but then if you use bytecode camlp4 it slows right down again
mort___ has joined #ocaml
<orbitz> and passing -j works
mort___ has quit [Client Quit]
<hongboz> avsm: camlp4 using .cmxs is pretty fast
<avsm> yeah, it works great. just need to port all the packages to use it (and i couldnt convince ocamlfind to use them)
<hongboz> avsm: I wrote myocamlbuild.ml to handle syntax extension, it works much better than ocamlfind
<hongboz> has anyone tried to embed toplevel in your ocaml application?
<avsm> yeah, me too. i've got a https://github.com/mirage/ocaml-build-skeleton/blob/master/files/cmd configure script, which writes a _config/ directory that is picked up by a myocamlbuild.ml
<avsm> so the build doesnt require ocamlfind, only the configure step
<hongboz> You only need to declare the link order. it works well with other stuff, like _pp.ml, inferred.mli
<avsm> nice. where do you declare link order?
<hongboz> syntax_lib_file
<hongboz> It's necessary indeed, since camlp4 depends on the link order
<avsm> yeah, type conv and such
<hongboz> I improved camlp4 a bit, the delimeter is <<a a>>
<hongboz> a is an arbitray symbol char
<hongboz> the antiquotation should be .$ $. instead of $$ which gives you ability to arbitrary quotation, antiqutoation
osa1 has joined #ocaml
edwin has left #ocaml []
<adrien> avsm: according to thomas gazagnaire, ocamlfind fully reparses the package list (i.e. all META files on disk) for each package
<adrien> so if you pull 20 packages...
<avsm> yeah indeed...
<adrien> avsm: otoh, if you stop using ocamlfind completely, I can come to cambridge with two pairs of boxing gloves :P
<adrien> (back to Monty Python)
<adrien> btw, for oasis' setup.ml, I have a makefile rule to compile it only when needed; in practice I never see it
<adrien> (and I build projects with a dozen files and packs and lots of C libs to link in, in a couple of seconds, on my small laptop (it really isn't fast))
pango has quit [Ping timeout: 252 seconds]
pango has joined #ocaml
Tobu has quit [Remote host closed the connection]
<avsm> heh, monty python is on tv right now
<avsm> the issue is debugging, for me
<avsm> so much time lost on subtle double-linking problems
<avsm> and the codebases are really large, with lots of camlp4
Tobu has joined #ocaml
<avsm> ho hum, use_dynlink tag appears broken on native (no dynlink.cmxa in stdlib?)
* avsm collects up notes to file on mantis for gasche_ :)
Submarine has quit [Ping timeout: 250 seconds]
<Anarchos> hi Hodapp
<tbrady> Is this a fair statement: "ocaml is about as fast a language as you'll find with GC" I recently told someone that, but don't have hard evidence.
<Anarchos> tbrady such statements are very general, and don't forget that you can configure the GC in many parameters
<Qrntz> well, one could attach a gc to C or C++… :-)
<Qrntz> but generally benchmarks tend to differ and what Anarchos said
<tbrady> Anarchos: yes. it was just based on gut feeling. I've written a fair amount of Haskell and Java and ocaml *feels* faster to me than those two. Though I've only done a little head-to-head testing.
<orbitz> The statement doesn' tmake much sense
<orbitz> You might phrase it as "of languages with GC's, Ocaml is the fastest"
<orbitz> But I'm not sure that's true, ATS usually beats the pants of Ocaml doesn't it?
EmmanuelOga has quit [Ping timeout: 244 seconds]
<Anarchos> tbrady to me too ocamlnative programs feel really fast
<Anarchos> tbrady not mentioning ocaml programs are easier to write than java ones...
<tbrady> Anarchos: I agree on both counts.
<tbrady> orbitz: Yeah, but ATS is so strange.
<orbitz> tbrady: I don't think "strangess" was a parameter of your statement :)
<tbrady> haha, no, but I didn't consider it because it seems to esoteric.
<tbrady> s/to/too
<Qrntz> orbitz, after translation it's basically C with a GC afaik
<adrien> tbrady: you can run java on specialized hardware too, makes the GC quite a lot faster afaik :P
<orbitz> Qrntz: Yeah, I know, but the whole point was if ocaml is as fast as you get with a GC, so it's a counter example
<Qrntz> as in, it translates to C and I'm pretty sure garbage-collected C will beat anything else garbage-collected just because of the C part of it :-p
<Anarchos> tbrady what is ats ?
<orbitz> Qrntz: That isn't true
<adrien> Qrntz: that supposes the C even runs properly
<adrien> (gcc not optimizing tail recursion as much as ocaml does)
<orbitz> Just because somethign is C doesn't make it fast. You could compile Python to C
<orbitz> I doubt it'd be faster than Ocaml
<adrien> I know _lots_ of people who'll write C and make it slow too :P
<Anarchos> orbitz ATS seems really exotic and close to COQ rather OCaml...
<orbitz> Anarchos: It's its own beast
<K_F> imho it all come down to the use, knowing, and using, several languages that are optimized for the task at hand will always be better than using a single one for everything
<K_F> although I'm suprised nobody has brought up low-level programming (assembly,...)
<Anarchos> K_F from a computer science engineer point of view : a language eaasy to test and to maintain is far more preferable in a professional context than a fast one.
osa1 has quit [Quit: Konversation terminated!]
<K_F> that depend on the use, not if you're doing millisecond operations
<Anarchos> K_F sure. But for millisecond operations you only have choice between C and ASM...
<orbitz> Ada
<Qrntz> fortran
<Qrntz> a lot of people forget fortran is still in use today…
<K_F> my point was mostly that whichever language is faster depends on the application of the code written
<K_F> and the skill of the programmer...
<K_F> I quite like ocaml, but I certainly wouldn't use it for _everything_
<orbitz> K_F: Sure, but the oriignal statement that started this was a discussion o if Ocaml is generally the fastest language iwth GC
<K_F> important word there; "generally" :)
<orbitz> Yes, I know
<Anarchos> orbitz hotspot is really good to optimize java on J2EE servers if i remember correctly
<K_F> can save your arse quite a few times to not be specific :)
<adrien> I use OCaml, unless there is programming language that specifically fits the job
<orbitz> I mostly prefer Ocaml for error handling, not speed, the speed is just a nice benefit
<adrien> well, being able to use a language while knowing you won't be hampered by its slowness is pretty important too
<adrien> bbl, packaging gettext now
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
Cyanure has joined #ocaml
<mrvn> Has anyone used the Marshal module for inter process communication?
<_habnabit> yes
<mrvn> with non-blocking IO?
<_habnabit> yeah
<mrvn> any tips what to do or what to avoid?
<_habnabit> I never really had any issues with it. I wrote a minimal thing on top of Unix.select and ... let's see
<_habnabit> oh, right. made a little buffer type using strings
ftrvxmtrx has quit [Quit: Leaving]
<_habnabit> since Marshal transmits one fixed-length string, and then another string with a known length.
<mrvn> I figure I have to read into a string, then check if I have header_size bytes. Then check how many data bytes I need and wait for that
<_habnabit> actually I guess I could just link this whole module
<_habnabit> it was one of the first things I wrote in ocaml, though, so it's not really the best
<_habnabit> I've tried to avoid touching it since because it's been working without issues
tbrady has quit [Quit: tbrady]
<mrvn> can't use that verbatim. I have some connections that are plain sockets and then ocaml modules connect and do jobs.
<_habnabit> well yeah
<Anarchos> mrvn you can also use named pipes with Unix.mkfifo ?
<_habnabit> but there's the parts that buffer
<_habnabit> see lines 73-94 and 174-187
<mrvn> Should have used the buffer module
<_habnabit> why?
<mrvn> easier then reimplementing it
<_habnabit> Buffer doesn't use Unix.read
<mrvn> so? YOu do Unix.read and then Buffer.add
<_habnabit> yes, but Unix.read takes a string argument anyway
<_habnabit> and a position
<_habnabit> so yes, this is reimplementing a very small part of Buffer, but it would contort the code _more_ to use Buffer at all
Tobu_ has joined #ocaml
Tobu has quit [Ping timeout: 248 seconds]
Snark has quit [Quit: Quitte]
sepp2k has quit [Quit: Leaving.]
sepp2k has joined #ocaml
<mrvn> now I've got another compication. I need to limit the output on the socket to 2 lines per second after the first 10 (or so) lines.
Submarine has quit [Ping timeout: 264 seconds]
sepp2k1 has joined #ocaml
sepp2k has quit [Ping timeout: 264 seconds]
pou has quit [Ping timeout: 276 seconds]
<Anarchos> mrvn use posix signals ?
tchell has quit [Ping timeout: 246 seconds]
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
diml has quit [Remote host closed the connection]
Oejet has left #ocaml []
diml has joined #ocaml
tchell has joined #ocaml
ftrvxmtrx has joined #ocaml
cdidd has quit [Quit: Leaving]
eni has quit [Quit: Leaving]
eni has joined #ocaml
cdidd has joined #ocaml
ftrvxmtrx has quit [Quit: Leaving]
ftrvxmtrx has joined #ocaml
bremac has joined #ocaml
ftrvxmtrx has quit [Read error: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number]
ftrvxmtrx has joined #ocaml
Cyanure has quit [Remote host closed the connection]
eni has quit [Quit: Leaving]
emmanuelux has joined #ocaml
gnuvince has quit [Ping timeout: 264 seconds]
EmmanuelOga has joined #ocaml
EmmanuelOga has quit [Client Quit]
<ssbr> writing camlp4 lexers with ocamllex -- good idea?
<ssbr> Or else how should I write a lexer?
<_habnabit> I've used ocamllex and a simple regexp thing
<_habnabit> I mean--I wrote a thing for lexing strings using a regexp for grammars which have only 2-4 kinds of token
<Anarchos> ssbr you have a Lexgen module for simple lexers
<ssbr> Anarchos: I don't really expect it to be simple. I was gonna try parsing Haskell
<_habnabit> haha welp
<ssbr> the issue is that I don't really know what lexers in camlp4 are like. The tutorial basically says, "just edit the ocaml lexer", and the manual says gibberish
<ssbr> (the manual punts to some tok_func, but it doesn't tell you what tok_func's type should be for example)
<_habnabit> how does ghc parse haskell?
<ssbr> _habnabit: I dunno, magic
<_habnabit> heh
<ssbr> I was gonna work off the spec!
<_habnabit> it might be useful to look at a reference implementation
<_habnabit> oh, how does the spec define the grammar?
<ssbr> _habnabit: using BNF
<_habnabit> ah
<_habnabit> that would be easy to translate to ocamllex afak
<ssbr> it defines the tokenizer a bit less formally, but it still should be reasonable
<_habnabit> afaik
<ssbr> _habnabit: well there's some slightly complex non-bnf-related stuff that goes on at lexing, involving the layout rules for whitespace
<pippijn> haskell requires you to do a partial semantic analysis when parsing
<ssbr> pippijn: I didn't see anything like that
<pippijn> I don't know for sure
<pippijn> but how else would you parse operators?
<ssbr> It has some rules that are special-cased, like "if you don't see a { token after a do/... token, then insert <...>"
<pippijn> they have fixity and precedence defined in code
<ssbr> ah, right.
<_habnabit> _what_
<_habnabit> haskell lets you define that?
<ssbr> _habnabit: all the cool PLs do that now, dontcha know
<pippijn> _habnabit: SML lets you do that
<ssbr> anyway I still don't really know how to write a lexer for camlp4. Is there something I should read?
<pippijn> and haskell
<ssbr> and ATS
<ssbr> (nobody cares about ATS though)
<pippijn> I like ATS
<pippijn> I like it very much
<ssbr> I like it very m@uch !too
<pippijn> but I don't like t@ype
<pippijn> ssbr: yes, the syntax is meh :(
<ssbr> Actually the thing that's most bothersome is the lack of reading material. It's a hard language to learn, and it's also a very big language (as these things go).
<pippijn> I found the compiler source pretty useful
<ssbr> And probably after that is how safety can cost you a lot. I'd be happier with a language that's less focused on being able to do everything C can do, and more focused on being fun
<ssbr> something like ocaml, except defined in terms of the C type system / interoperable both ways with C, maybe
<pippijn> yes
<pippijn> I'd like that
<pippijn> I'm actually kind of working on that every now and then
<ssbr> I really want it :(
<ssbr> Everything that could possibly replace C is not-fun. ATS is actually crazy, and also doesn't align as well as it should with the T type system, D can't write shared libraries, C++ is C++, Haskell requires manually writing bindings for everything, etc.
<ssbr> I guess maybe I should look at Go
<ssbr> also Rust
gnuvince has joined #ocaml
emmanuelux has quit [Ping timeout: 252 seconds]
emmanuelux has joined #ocaml
emmanuel__ has joined #ocaml
tbrady has joined #ocaml
emmanuelux has quit [Ping timeout: 264 seconds]
<Anarchos> i think that we lack a language with functions as first-class values, static typing and able to do bit fiddling....
<Anarchos> cause low level system programming requires bit manipulation
<Ptival> C ? :D
gnuvince has quit [Ping timeout: 248 seconds]
<ssbr> Anarchos: ocaml can't do bit fiddling?
<ssbr> or haskell either? :(
<ssbr> Anarchos: bit fiddling is not what makes systems programming hard. Any language worth its salt has bit fiddling operations.
<Anarchos> ssbr well you can simulate bit arrays with integer...
<ssbr> Anarchos: Or you can just use an integer.
<ssbr> Anarchos: what in C would be & is the ocaml function land. What in C would be << is the ocaml function lsl. Etc.
bremac has quit [Quit: Leaving]
<sepp2k1> Anarchos: "Simulate"? How would you do bit fiddling in C if not using integers?
<ssbr> oh, I misread
<ssbr> Yeah, same issue.
lamawithonel has quit []
lamawithonel has joined #ocaml
<Anarchos> sepp2k1 i miss a concatenation of bit arrays as in low level specification (say Sparc V9 for example)
<Ptival> you'd actually use int32 or int64 rather than int
netrino_ has quit [Quit: Ave!]
<Anarchos> Ptival yes but int32 are boxed and take two C int32....
<Ptival> ok I see your point
<ssbr> Anarchos: that's separate from bit fiddling
<ssbr> Anarchos: if you want unboxed values, try an ML aimed at systems programming, like ATS
<Anarchos> ssbr i surely will give it a look on monday
<ssbr> (for your first-class function requirement, it has stack-allocated closures, garbage-collected closures, and manually managed (linear) closures)
Anarchos has quit [Quit: night time]
<ssbr> (obviously regular functions don't need management at all, and can be passed freely)