<rwmjones>
has anyone patched frama-c to work with ocaml 4.00.0 yet?
edwin has left #ocaml []
<rwmjones>
because the insane build system is really annoying me ..
xcombelle has quit [Quit: I am a manual virus, please copy me to your quit message.]
jeremie has joined #ocaml
jeremie has left #ocaml []
<rwmjones>
ocamlbuild ... yet again, obscure and impossible to follow
_andre has joined #ocaml
<pippijn>
rwmjones: oh, frama-c
<mehdid>
rwmjones: frama-c is not using ocamlbuild afaik
<mehdid>
how does it fail?
<rwmjones>
mehdid: the ocamlbuild rant was about ocaml-sexplib .. anyhow frama-c doesn't compile because of the new hashtbl with added functions
<rwmjones>
but it's a big nest of functors, and I've no idea where the original hash is being defined
<rwmjones>
functors are another thing that people should use less of IMHO
<rwmjones>
they're the OO of the functional world
<rwmjones>
impossible to follow the flow of control or find out where things are defined
<orbitz>
they can be quite confusing
<orbitz>
I still have only identified one or two use cases for functors for myself (usually just one level of indirection, removing some boiler plate code
xcombelle has joined #ocaml
silver has quit [Quit: I put on my robe and wizard hat]
silver has joined #ocaml
f[x] has quit [Remote host closed the connection]
mcclurmc_away is now known as mcclurmc
f[x] has joined #ocaml
<mehdid>
rwmjones: something to fix in src/type/datatype.ml* ?
<mehdid>
(I think the fix should be fairly easy)
<rwmjones>
possibly, but I don't see a Hashtbl derivative being defined there
<rwmjones>
the error is:
<rwmjones>
File "cil/src/cil_datatype.ml", line 1496, characters 5-12:
<rwmjones>
Error: Signature mismatch: ... The field `stats' is required but not provided The field `reset' is required but not provided
<orbitz>
what's going on here realloc (score_results, i * sizeof (struct score_result) {});
<rwmjones>
is the {} for real?
Progster has joined #ocaml
<rwmjones>
also is it C or C++ or something else?
<orbitz>
Whoops i though ti was in ##c
<orbitz>
but yes, it's C
<orbitz>
that {} must be a typo
<adrien>
or a code explaining where the secret treasure is buried
xcombelle has quit [Quit: I am a manual virus, please copy me to your quit message.]
<hcarty>
thelema_: Will there be a OCaml 4.00.0-compatible release of Batteries 1.x?
ontologi1e has joined #ocaml
ontologiae has quit [Ping timeout: 240 seconds]
<thelema_>
hcarty: yes
<hcarty>
thelema_: Neato
pcavs has joined #ocaml
ankit9_ has quit [Quit: Leaving]
pcavs has quit [Quit: Leaving.]
smondet has joined #ocaml
testcocoon has quit [Quit: Coyote finally caught me]
pou` has quit [Remote host closed the connection]
pou` has joined #ocaml
mika1 has quit [Quit: Leaving.]
_andre has quit [Ping timeout: 255 seconds]
pcavs has joined #ocaml
pou` has quit [Read error: Connection reset by peer]
_andre has joined #ocaml
pou` has joined #ocaml
pou` is now known as pou
testcocoon has joined #ocaml
<Drakken>
What does "reqs" stand for in odb.ml?
<thelema_>
Drakken: requirements
<fasta>
Using shell scripting I can run while true; myprogram; sleep 1; done, put a few echo statements in it and see how far it gets. Can I do the same thing with OCaml, also as programs get larger, or will the link time become a problem?
<fasta>
The myprogram part is written with shell scripts where this is a perfectly viable approach.
<thelema_>
link time is generally not a problem for ocaml, even for big programs
<fasta>
thelema_: doesn't it use ld?
<thelema_>
yes, although it can also use ld_gold
<fasta>
thelema_: ld + C/C++ is slow in my experience.
<fasta>
thelema_: why is it different with OCaml?
<thelema_>
ocaml doesn't compile to C/C++, but to assembly, and while there are link-time optimizations that happen, they're pretty efficient.
<fasta>
thelema_: C/C++ also compile to asssembly. I don't understand the argument.
<thelema_>
as far as your first question, yes, you can do this in ocaml; you can even avoid recompiling by using #!/bin/ocaml
<thelema_>
and running your ocaml program as a bytecode script
<fasta>
thelema_: doing the same thing with Haskell is not practical.
<thelema_>
fasta: C++ does a lot more work link-time
<fasta>
thelema_: it takes ages to start the RTS.
<thelema_>
ocaml's runtime starts very quickly
<fasta>
thelema_: and to do all the parsing, etc.
<thelema_>
fasta: try it out, it should be fast enough for you.
<fasta>
thelema_: does the byte code interpreter work line based or file based?
<thelema_>
file
<fasta>
thelema_: is that because it is 'fast enough'?
<fasta>
thelema_: because in principle there is no need to read the whole file to determine what could be executed.
<thelema_>
true, the byte code interpreter could be phrase based.
<mcstar>
ocaml is strongly typed
<fasta>
mcstar: this is irrelevant.
<thelema_>
I'm not certain, actually. even my script only has on... well, it actually has two entry points
<mcstar>
why? it has to typecheck the whole program
<thelema_>
but just command-line parsing happens at the first
<fasta>
mcstar: no, it doesn't.
<fasta>
mcstar: at least not before the program runs.
<thelema_>
ocaml interpreter can work on the phrase level
<thelema_>
just like pasting into the toplevel
<fasta>
thelema_: yeah, how?
<thelema_>
fasta: ?? ocaml programs are structured in toplevel phrases
<thelema_>
a single toplevel type or value definition is a phrase
<fasta>
thelema_: before you said it was file based.
<thelema_>
yes, I thought it was.
<fasta>
thelema_: ok, so it already does things optimally then.
<thelema_>
It might actually be phrase based, but I didn't notice because I only have one real entry point
<mcstar>
so, when i run a file, with ocaml, is it possible to get a type error at run-time??
<mcstar>
if you say so ill believe you, but it sounds weird
<fasta>
thelema_: I will do a simple test here.
<thelema_>
nope, it is file-based
<hcarty>
mcstar: As far as I know that is not possible
<thelema_>
execution semantics is phrase-at-a-time in declaration order, but if you have a syntax error anywhere in your file, it'll let you know.
<mcstar>
thank god
<thelema_>
that said, you can pipe your script into the toplevel, and it'll run phrase-at a time
<thelema_>
as long as you have ;; at the end of your phrases
<thelema_>
...
<thelema_>
hmm, I take that back.
<thelema_>
#!/usr/bin/env ocaml
<thelema_>
print_string "hello\n";;
<thelema_>
baz
<thelema_>
This will print "hello\n" before failing with a syntax error.
<fasta>
It does read the whole file first.
<fasta>
while true; do echo word >> foo.ml; done
<fasta>
If you leave that running for a while, you will notice that the time to load it goes up.
<fasta>
The first output appears after it has read the program.
<thelema_>
hmm... could be. How big of an input are you planning?
<mcstar>
that doest mean it starts to parse it
<fasta>
mcstar: yes it does, because it reports the error before the output.
<fasta>
mcstar: even though the output is written first in the program.
<thelema_>
fasta: only because stdout is buffered
<fasta>
thelema_: ok, how can I test with unbuffered stdout?
<thelema_>
flush stdout
<thelema_>
print_string "hello\n"; flush stdout;;
<hcarty>
Or use prerr_endline/eprintf
<hcarty>
Or printf "%s\n%!" some_string
<fasta>
Ok, now it comes out first, but the delay increases with increased file size.
<fasta>
So, it is not ;; based.
<thelema_>
execution is ;; based
<thelema_>
and clearly parsing is ;; based
<fasta>
I.e. it doesn't execute when it can.
<fasta>
thelema_: you can say all kinds of things; doesn't mean it is true.
<fasta>
thelema_: test if for yourself.
<thelema_>
fasta: it's open source, you're welcome to fix it so that it reads the input progressively
<fasta>
Create a file called foo.ml with some suitable print_endline "hello";; contents. while true; do echo word >> foo.ml; done
<thelema_>
executing as it reads.
<fasta>
thelema_: except I cannot distribute it.
<thelema_>
I still can't imagine why you want this.
<thelema_>
you can distribute as original source + patch
<mcstar>
me neither
<mcstar>
do you want to keep the ocamlrun file.ml in a while loop, while you edit the file? or what?
<thelema_>
QPL is stupid, but if your patch is useful to anyone but you, it's survivable
<fasta>
thelema_: I find your response rather odd. First you do care about it, then I point out that OCaml has a weakness here, then you say it is open-source and then you say you cannot imagine why I would want this, but I already pointed that out at the beginning of the discussion.
<fasta>
mcstar: yes
<mcstar>
ok, very weird, no offense, but i cant imagine why would you want to do that
<thelema_>
your original explanation does not motivate needing the ability to input a huge file and only execute the first part of it.
<thelema_>
I care about it on a theoretical level, but still dont see the practical use.
<fasta>
thelema_: it's likely 'fast enough' as it is.
<fasta>
thelema_: on a 560K source file it took about 0.4 seconds.
<adrien>
fasta: ocaml sentences are separated with ";;"
<adrien>
it parses them as a single element
<fasta>
adrien: yes, but they are not executed when they could already be executed.
<adrien>
writing 'word;;' instead of 'word' would be very different
<fasta>
adrien: I wrote print_endline "hello world!";;word<newline>word<newline>etc.
<fasta>
adrien: including a newline after ;;
<fasta>
(not that it should matter)
<adrien>
it wouldn't matter
<thelema_>
and because of this, ocaml has to read all your words before it started to parse them
<adrien>
but I expect ocaml* to load the file completely first
<adrien>
foo;;
<adrien>
bar;;
<thelema_>
if you wrote word;;word;;, it should fail on the first one.
<adrien>
shouldn't generate two read calls
<fasta>
thelema_: no, no, no.
<fasta>
thelema_: I said that it didn't execute print_endline when it already could.
<thelema_>
really? it does for me.
<fasta>
thelema_: how long is your file?
<thelema_>
or are you saying that the print_endline is delayed by the words?
<fasta>
thelema_: yes
<fasta>
thelema_: I test it as ocaml foo.ml
<thelema_>
haven't tried that; working to fix my ' key atm.
<fasta>
O'Caml is OCaml these days
<fasta>
No need for that ;)
<thelema_>
yes yes.
<fasta>
adrien: what exactly did you intend to communicate, because I don't see how you said anything which was inconsistent with what already established before?
<mcstar>
fasta: i think you need python
<fasta>
mcstar: I am fairly sure python also parses the whole file first
<fasta>
mcstar: and I am not sure how you get to that idea.
<fasta>
mcstar: just because I like fast development iterations, doesn't mean I don't like good deployment models.
<mcstar>
well, python loads the whole file, and does a syntactic analysis on it
<mcstar>
but doest compile it at once
<mcstar>
afaik
<mcstar>
so you can spare time
<fasta>
mcstar: so, you would still have the same problem.
<fasta>
Using word;; doesn't make any difference.
<mcstar>
im not convinced that 'ocaml' doesnt 'compile' the file after it loads it
<fasta>
mcstar: but that's not what this is about.
<thelema_>
you're right. using strace, it looks like ocaml does read the whole file before executing any of it.
<fasta>
mcstar: that's just something you invented that this discussion is about.
<mcstar>
dont you want to make your test cycle shorter?
<adrien>
it just reads the file, that's what takes time
<adrien>
and I _want_ it to do it like that
<ocp>
@fasta: you can use the Toploop module to evaluate dynamically generated code within your script
<adrien>
because how could it read in smaller chunks? and should it call read() for 6 bytes each time?
<ocp>
a combination of Toploop.parse_toplevel_phrase and Toploop.execute_phrase
<adrien>
ocp: btw, ocaml-lang.org needs an update ;-)
<ocp>
adrien: yes, you are right !
<fasta>
adrien: no, it should read 4096 bytes, then interpret/execute whatever it can.
<fasta>
adrien: then continue that.
<adrien>
no it shouldn't because it is quite like that there is nothing to interpret in these 4K
NeuroHacker has joined #ocaml
<fasta>
adrien: what do you mean?
<fasta>
adrien: it should just use co-routines.
<adrien>
it will look for either ';;' or EOF
<adrien>
that wouldn't change anything
<fasta>
adrien: and print_endline "hello";; has no ;; according to you?
<adrien>
if it doesn't find ';;' or EOF, it would have to cancel what it had started quite probably
<mcstar>
and after 'ocaml' loads the file it doesnt compile the whole into bytecode, i get output, and a typeerror
<mcstar>
so it is perfect for you fasta
<adrien>
unless it added an extra level of complexity
<adrien>
fasta: my point is that the common-case is: no ';;' nor EOF in the first 4K
<adrien>
it's not something you can foresee
<adrien>
so no point in trying to play smart for an exceptional case
<adrien>
s/exceptional/unlikely/
<adrien>
for a limited gain
<fasta>
adrien: I doubt much is won in this way.
<adrien>
you think
<adrien>
ocaml is not always fast to compile
<adrien>
so if it had to do some things thrice of four times, I would *hate* it
<adrien>
and that's for 16KB files
<adrien>
which is not even big
<adrien>
-rw-r--r-- 1 adrien users 18K Jun 10 17:46 typesSexp.ml
<fasta>
adrien: where am I saying that it would have to do things more than once?
<adrien>
% wc -l typesSexp.ml
<adrien>
435 typesSexp.ml
<adrien>
fasta: how do you make a parser that works on half of an input?
<adrien>
do you think it's as simple?
<fasta>
adrien: I would read until I see ;; or EOF like you said.
<fasta>
adrien: then I would parse that stuff.
<thelema_>
fasta: except for ;; in quotes or in a comment
<fasta>
adrien: and from the AST, generate byte code or interpret directly.
<fasta>
thelema_: which is trivially filtered out.
<adrien>
by a first pass?
<adrien>
more work
<adrien>
more complexity
<fasta>
adrien: you don't need more than one pass.
<adrien>
uncommon case, small gains
<mcstar>
fasta: do you understand, that if you dont have a syntax error, the file will pass, and it will execute the code ;; by ;;?
<adrien>
fasta: why? because you've started parsing?
<fasta>
adrien: what do you mean?
<thelema_>
really? ocaml comments nest, and quotes inside comments are respected, so (* (* "*)" *) ;; *) still has ;; inside comment.
<fasta>
adrien: you can keep a counter of the current comment nesting level.
<adrien>
no
<fasta>
adrien: and why not?
<adrien>
fasta: check the syntax-highlighting file for emacs
<fasta>
adrien: I wrote syntax-highlighters.
<adrien>
because ";;" as a string isn't an end either
<adrien>
check the one for ocaml obviously
<fasta>
adrien: so?
<fasta>
adrien: you can also keep track of that.
<fasta>
adrien: using one bool.
<fasta>
adrien: all I see is you finding excuses for something which isn't that hard and for something I have already done before.
<adrien>
so, in essence, you're already scanning your input, and doing some work
<fasta>
adrien: a tiny bit of work yes, which on a modern CPU has zero cost.
<hcarty>
Out of curiosity - if it's already been established that no one here has an issue with the toplevel file loading performance, why is this argument going on?
<fasta>
adrien: because of instruction parallelism.
<thelema_>
all this complexity added to the compiler to make your rare use case slightly faster? This is why OCaml isn't a mess - the guardians of the repo (possibly unfairly) have rejected adding unnecessary complexity to the compiler
<adrien>
curl/c-ares is worth taking a quick look at, facepalm guaranteed
<Anarchos>
adrien i have nothing agains ocamlbuild, which works nice for my small projects :)
thomasga has quit [Quit: Leaving.]
<adrien>
well, I've seen quite a lot of people thinking building ocaml software sucks
<adrien>
people don't complain about C libraries only because they're already installed but in general they're really much much worse
<jonafan>
i think ocamlbuild is awesome
<dsheets>
ocamlbuild+ocamlfind is pretty good… the packaging systems are what is really needed, though
<jonafan>
i learned of it after a long time of writing make files or compiling manually
<Anarchos>
adrien C headers and library dependencies are a hell. Anyone should admit it or be burnt !
<jonafan>
and basically i'm an idiot for not using it earlier
<adrien>
Anarchos: that's not really the issue hover
Progster has quit [Ping timeout: 248 seconds]
<adrien>
however
fraggle_ has quit [Read error: Connection timed out]
<dsheets>
cpan/npm/cabal are really nice and i want something similar
<adrien>
for most issues, it looks like people have been sabotaging everything knowingly
<Anarchos>
adrien you speak about C ? ;)
<adrien>
remove files, add crappy install hooks, add your own awful tests...
<adrien>
Anarchos: the build systems ;-)
<adrien>
for the things I've mentioned in the page linked above
<adrien>
I need to go to sleep: good night
<Anarchos>
good night adrien
fraggle_ has joined #ocaml
contempt has quit [Ping timeout: 244 seconds]
wormphlegm has quit [Ping timeout: 244 seconds]
contempt has joined #ocaml
pippijn has quit [Ping timeout: 244 seconds]
dgfitch_ has quit [Ping timeout: 244 seconds]
wormphlegm has joined #ocaml
dgfitch has joined #ocaml
pippijn has joined #ocaml
pippijn has quit [Changing host]
pippijn has joined #ocaml
hcarty has quit [Ping timeout: 244 seconds]
hcarty has joined #ocaml
ski has quit [Ping timeout: 250 seconds]
jave has quit [Read error: Connection reset by peer]
jave_ has joined #ocaml
ski has joined #ocaml
Submarine has quit [Ping timeout: 240 seconds]
bzzbzz has quit [Quit: leaving]
smondet has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
<dsheets>
I have a little structured language without nesting but including quotation characters (both substrings and individual character escapes) and delimiters. What is the best way to parse this into a data structure in OCaml?
<dsheets>
ocamllex + ocamlyacc seems a little heavyweight but i might be convinced
<Anarchos>
dsheets Genlex + Lexer modules ?
<dsheets>
ooo Genlex, thank you
pango_ has joined #ocaml
pango has quit [Disconnected by services]
pango_ is now known as pango
sepp2k has quit [Remote host closed the connection]
ulfdoz has quit [Ping timeout: 252 seconds]
<Anarchos>
dsheets let me know if it fulfills your needs
jamii has joined #ocaml
oriba has quit [Quit: oriba]
Anarchos has quit [Quit: Vision[0.9.7-H-090423]: i've been blurred!]