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/
thomasga1 has quit [Quit: Leaving.]
osnr has quit [Read error: Operation timed out]
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
jcao219 has joined #ocaml
<olafurw> Batteries seem like a must have library, any others that are good to have when developing with ocaml
breakds has joined #ocaml
<troydm> olafurw: pretty much all janestreet stuff
<rgrinberg1> olafurw: sexplib
<troydm> also Lwt i guess
<olafurw> thanks
travisbrady has joined #ocaml
travisbrady has quit [Client Quit]
osnr has quit [Quit: Leaving.]
demonimin has quit [Ping timeout: 246 seconds]
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
sclv has quit [Ping timeout: 256 seconds]
Neros has joined #ocaml
demonimin has joined #ocaml
sclv has joined #ocaml
pootler_3 has quit [Ping timeout: 246 seconds]
pootler_ has quit [Ping timeout: 246 seconds]
csakatoku has joined #ocaml
mk270 has left #ocaml []
<pippijn> olafurw: I like deriving-ocsigen
structuralist has quit []
madroach has quit [Ping timeout: 248 seconds]
madroach has joined #ocaml
<whitequark> hm, say I have a .ml file in the current directory, and I want to load it with utop
<whitequark> how do I do that?
osnr1 has joined #ocaml
osnr has quit [Ping timeout: 248 seconds]
<Drup> whitequark: #use
<whitequark> Drup: thanks
<whitequark> why can't I use let..in in toplevel?
<whitequark> File "main.ml", line 3, characters 11-13:
<whitequark> Error: Syntax error
<whitequark> and the characters point to "in"
<Drup> you can, but you have to terminate a sentence by ";;"
<Drup> "let x = 3 in x + x ;;" should work fine
<whitequark> oh I see
<whitequark> no, it still fails.
breakds has quit [Quit: Konversation terminated!]
<whitequark> not in utop toplevel; .ml toplevel
<Drup> it's the same
<whitequark> well, it doesn't work :/
<Drup> pastebin the code :)
<whitequark> it's literally what you wrote
<whitequark> but ok
<whitequark> and I do ocamlbuild main.native
<Drup> oh, you're compiling it
<Drup> that's different then
<whitequark> um, what?
JcGood has joined #ocaml
<Drup> there is a really big problem with ocaml that the syntax understood by the interpreter is slightly different than the one you should use when compiling a file
<Drup> in the intepreter, you have to end *every single sentence* with a ";;", including those "open"
<whitequark> yeah, I know this
introom has joined #ocaml
<Drup> when compiling, your better whitout it since it's the source of lot's of silly parsing errors
talzeus_ has quit [Read error: Connection reset by peer]
<whitequark> ok
<whitequark> how do I get let..in to work in a compiled toplevel?
<whitequark> or is there no way?
<Drup> let .. in is not for top level declaration, no
<Drup> you can cheat with some code in "let _ = blabla"
<whitequark> so I can use let..in inside blabla?
<Drup> yes
<whitequark> that's... ugly
<whitequark> but ok
<Drup> "let <binding> in <expr>" is an <expr>
dsheets has quit [Ping timeout: 246 seconds]
<Drup> whitequark: technically, you can do a succession of sentence as if you were in the interpreter and compile it, it should work, but it's very painful very quickly
<bernardofpc> Because of the ;; ?
<bernardofpc> or the "in" ?
<Drup> the ;;
<whitequark> Drup: I see
<whitequark> is it possible to somehow tell ocamlbuild to always -use-ocamlfind -use-menhir ?
asmanur_ has quit [Ping timeout: 276 seconds]
asmanur has joined #ocaml
<Drup> for menhir, with a tag, probably
<Drup> for ocamlfind .. no
<Drup> (afaik)
<pippijn> whitequark: better use oasis
<pippijn> who was doing Qt in ocaml?
<whitequark> pippijn: oasis?
<pippijn> oasis.forge.ocamlcore.org
<whitequark> yum sooo it's a wrapper around ocamlbuild
<whitequark> and ocamlbuild is a wrapper around ocamlc
<Drup> pippijn: kakadu ?
<pippijn> oh yeah
<Drup> whitequark: it's more like a bloated metadata cruncher
<Drup> (but it's still convenient)
<pippijn> ok
<pippijn> maybe if you see kakadu, you can show him https://paste.xinu.at/kRTxY/
<pippijn> it's my first test with qt and ocaml
osnr1 has quit [Quit: Leaving.]
<whitequark> pippijn: doesn't exist
kanibe has quit [Ping timeout: 248 seconds]
<whitequark> hm, ocamlbuild's giving me errors somewhere in menhir-generated code, but there's no .ml files
<whitequark> "Syntax error". duh, can it be more helpful
<pippijn> yeah, that's ocamlc
<pippijn> because it uses ocamlyacc for its parser (I guess)
<pippijn> that doesn't give state/token info on error
<pippijn> unlike menhir with my patch
<whitequark> File "parser.mli", line 5, characters 2-3:
<whitequark> Error: Syntax error
<whitequark> what the hell does it not like there
<pippijn> the ,
<pippijn> you need *
<pippijn> and no ()
<whitequark> oooh right
<whitequark> * in types
<whitequark> () are added by menhir
<pippijn> ok
<whitequark> awesome, works.
<pippijn> ok, you're right, () is added by menhir
<pippijn> :q
<whitequark> heh
<whitequark> ok, it almost compiles!
talzeus has joined #ocaml
mlh has joined #ocaml
kanibe has joined #ocaml
<pippijn> pippijn@osiris hm $ echo "let o =" | ./hm.opt -
<pippijn> (6) unexpected end of file; expected one of: "fun", "let", "identifier", "integer", "("
<pippijn> whitequark: are you interested in having proper error messages from menhir parsers?
<whitequark> pippijn: absolutely
<pippijn> I have a project about that
<whitequark> though it would probably still be worse than handwritten LL(1)
<whitequark> quite a bit
<pippijn> sure
<pippijn> always
<whitequark> but really, the way ocaml reports them now just plain out sucks
<whitequark> am I supposed to have telepathy
<pippijn> well, if you want better ocaml error messages, you either need to use camlp4
<pippijn> or change the ocaml compiler
<pippijn> basically you just need to make it use menhir with my patch
<pippijn> might actually be a fun test for my error generator :)
<whitequark> hmmm
<whitequark> and how I do that?
<pippijn> do what?
<whitequark> make the compiler use your menhir variant :p
<whitequark> note that I've yet to write a working ocaml program.
<whitequark> well, nontrivial one.
<pippijn> well
<pippijn> I don't know
<whitequark> :D
<pippijn> you need to change the makefile in the ocaml sources
<pippijn> and probably make some small changes to the code
<pippijn> have you tried my online C parser?
<whitequark> mm ok. I'll look into it when I get more familiar with ocaml
<whitequark> pippijn: yeah
<pippijn> that uses menhir
<whitequark> input.c:5:1: (27) unexpected "}" token; did you mean one of ":"?
<whitequark> um, what?
<pippijn> that's automerr :)
<pippijn> it's not as good as hand-written error messages
<pippijn> try removing the ;
<pippijn> after return 0
<whitequark> foo()
<whitequark> still input.c:4:1: expected ';' after return statement
<whitequark> :p
<pippijn> so? isn't that good?
<whitequark> well, foo() isn't a return statement
<pippijn> you just put foo()?
<whitequark> but yeah, I see what you did there and I kind of like it
<whitequark> yes
<pippijn> oh
<whitequark> instead of return 0;
<pippijn> yeah
<pippijn> ok, it's far from finished
<whitequark> btw, how do you pretty-print parse tree? sexplib?
<pippijn> I'll remove the "return" in that error message
<pippijn> whitequark: yes
<whitequark> I want something like that for my token stream and parse tree
<pippijn> sexplib is the best
<pippijn> deriving (Show) is also nice, but it's one way
<pippijn> sexplib is in/out
<whitequark> hmm
<pippijn> and deriving (Show) can get ugly
<whitequark> ok. it seems that I need to append 'with sexp' to type definition
<whitequark> how do I do that in .mly?
<pippijn> you can't
<pippijn> you're basically out of options there
<pippijn> you can wrap menhir to do it
<whitequark> this is, uhm
<whitequark> sad
<pippijn> you can copy the token definition into another file
<pippijn> by hand
<pippijn> and add "with sexp"
<whitequark> and I suppose there is no easier way?
<whitequark> something like ruby's p() function
<pippijn> I don't know p()
<whitequark> "just print the damn structure in whatever format you like"
<pippijn> no
<whitequark> how does utop do it?
<pippijn> with type information
<pippijn> which is lost in compiled code
<whitequark> ok.
<whitequark> is there an easy way to load the whole project in utop?
<whitequark> mll/mly/ml
<pippijn> if you make a library, you can load the library
<pippijn> #load "mylib.cma";;
<whitequark> sigh
<whitequark> ok. if I copy the type declaration from parser.ml to another file and add with_sexp to it
<whitequark> won't that create another type and a set of functions for it?
<pippijn> not if you tell ocaml it's the same
<pippijn> type t = Token.t = ... with sexp
<whitequark> ok
<whitequark> and how do I enable sexplib for my app? it seems to barf on 'with sexp', I guess it needs a preprocessing step?
<pippijn> yes
<pippijn> you need camlp4
<pippijn> something about syntax_camlp4o or so
<pippijn> in _tags
<whitequark> + ocamlfind ocamldep -package core -syntax camlp4o -modules main.ml > main.ml.depends
<whitequark> ocamlfind: Using -syntax, but no package is selected specifying a preprocessor as required for -syntax
f[x] has joined #ocaml
<pippijn> add sexplib.syntax to the build dependencies
<whitequark> aha, package(sexplib.syntax) seems to have fixed it
<whitequark> awesome
<whitequark> thanks
<pippijn> that's another way, yes, but then oasis won't check it's there
<whitequark> hm? what's the other one?
<whitequark> and by the way, it barfs on type tok = (int * int) with sexp
<whitequark> Error: Unbound value int_of_sexp
<whitequark> shouldn't that be provided by the library?
<pippijn> 04:54 < pippijn> add sexplib.syntax to the build dependencies
<pippijn> oh, you're not using oasis
<pippijn> then never mind
<whitequark> just ocamlbuild
<pippijn> yes
<pippijn> then it's fine
ben_zen has joined #ocaml
<whitequark> ok, so it also wanted open Core.Std
<whitequark> every single one of those errors are as user-nonfriendly as it's possible. :/
<whitequark> wheeeee, it (INT ((0 3) 100))
<pippijn> :)
breakds has joined #ocaml
<pippijn> are some examples of deriving (Show)
<whitequark> mm ok
<whitequark> I guess I'm fine with sexplib?
<whitequark> it seems ok
<pippijn> yes
<pippijn> I like sexplib
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
<whitequark> in completely unrelated stuff
<whitequark> val (||) : bool -> bool -> bool
<whitequark> The boolean ``or''. Evaluation is sequential, left-to-right: in e1 || e2, e1 is evaluated first, and if it returns true, e2 is not evaluated at all.
<whitequark> how is this implemented? a parser hack?
<pippijn> why parser hack?
<whitequark> well, ocaml is strict, isn't it?
<pippijn> ah
<pippijn> you mean that :)
<whitequark> yes
<pippijn> basically, yes
<pippijn> except it's not a parser hack
<pippijn> but a semantics hack
<pippijn> the compiler special-cases Pervasives.(||)
<whitequark> # let myor = (||) in myor (printf "1"; true) (printf "2"; true);;
<whitequark> 2121
<whitequark> er, just 21
<pippijn> right
<whitequark> so it is, well, a parser hack: || under any different name isn't ||
<pippijn> the same with let (||) = (||) in ...
<pippijn> no, not a parser hack
<pippijn> the parser doesn't care where an operator comes from
<whitequark> oh ok, compiler hack :)
<pippijn> it's the type-checker that looks up names and assigns types etc.
<whitequark> right
<pippijn> and when going from ocaml to some intermediate language, Pervasives.(||) is special-cased
<pippijn> *** omake: done (4 min 20.62 sec, 326/728 scans, 442/2501 rules, 1612/9441 digests)
<pippijn> ok, now I have a lot of code in there..
<pippijn> I'm moving together all my projects into one tree
<pippijn> so I can build everything with one command
jtbt has joined #ocaml
jtbt has quit [Client Quit]
kanibe has quit [Ping timeout: 240 seconds]
breakds has quit [Remote host closed the connection]
ben_zen has quit [Quit: Ciao!]
yacks has quit [Quit: Leaving]
<pippijn> ok, now everything is in github
<pippijn> wmeyer: I put treematch into github
<pippijn> wmeyer: if you have an account, I can give you write access
kanibe has joined #ocaml
Drup has quit [Quit: Leaving.]
chrisdotcode has quit [Read error: Connection reset by peer]
<xenocons> does someone have that awesome cool project written to JS with js_of_ocaml that does C source code AST-esque analysis?
chrisdotcode has joined #ocaml
pootler_ has joined #ocaml
pootler__ has joined #ocaml
<xenocons> pippijn: nice, it was yours :)
<pippijn> yes
<pippijn> old version
<pippijn> I don't know if it still works
<xenocons> pippijn: i use it as my js_of_ocaml advocacy link
<pippijn> I am restructuring my projects
<xenocons> nice!
<pippijn> xenocons: with #hm, you get the hindley-milner test
<xenocons> wow, nice stuff
<xenocons> yeh this is cool
<xenocons> ooh bonus
<pippijn> the js part is not in there right now
<pippijn> but it hasn't changed, I think
<pippijn> actually the last one is nothing
<pippijn> just the first two
<xenocons> ok
<pippijn> oh, actually you do need the last one
<xenocons> its really neat seems hardly any work to get stuff ocaml -> JS
<pippijn> yeah
<pippijn> except you need https://paste.xinu.at/v81nXC/
<xenocons> rewned my interest after i saw the ycombinator post today about ghcjs
<xenocons> thats quite small though
<pippijn> some stubs for functions not implemented
<pippijn> if you want bigarray, you need to implement them
<pippijn> if you want batteries, you're out of luck
<xenocons> right
<xenocons> but thats acceptable
<pippijn> yes
<xenocons> pippijn: good project to look at for its C parsing capabilities alone
<xenocons> outside of the JS stuff
<pippijn> :)
<pippijn> it's not that good
<pippijn> it's the first thing I did in ocaml after hello world
<pippijn> I'll have to clean it up someday
<xenocons> heh, looks pretty good
<pippijn> it's not that messy, but I know more ocaml now
<xenocons> using the language itself (ocaml) rather than yac etc
<xenocons> yeah i know what you mean, i find i obsolete my own code every few months
<pippijn> huh?
<pippijn> I use menhir
<xenocons> ah
<pippijn> https://github.com/pippijn/menhir <- this menhir
<xenocons> cool, you wrote this too?
<pippijn> no
<pippijn> francois pottier wrote it
<xenocons> now i see the .mly files i was expecting heh
<pippijn> I just added one small feature
<pippijn> namely: error messages
<xenocons> nice
<pippijn> as you can see from the parser test page
<pippijn> it's not "Syntax error."
<xenocons> yes that is slightly uninformative
<whitequark> "slightly uninformative"
<whitequark> pippijn: any plans for upstreaming your menhir updates?
<xenocons> :)
<pippijn> whitequark: https://paste.xinu.at/Zulr/
<xenocons> whats BatParserCo like from batteries?
<whitequark> hm
<whitequark> I was thinking about code coverage lately
<whitequark> any of you seen "transition coverage" tools for validating FSMs?
<whitequark> seems like something that can be useful.
<pippijn> you mean to find dead states?
<whitequark> e.g. that would really help my Ruby parser. I've glued together a homegrown grammar actions coverage tool (there are usually almost none rules without actions, so it's OK)
<whitequark> pippijn: no, not like that
<whitequark> to force you write a testcase for every single possible transition in the FSM
<whitequark> this would uncover 80% of bugs which were found in my parser by trial and error.
<whitequark> note that action coverage is, by far, not enough, because most of these bugs occured in accidentally present/absent internal transition
<whitequark> in the _lexer_ FSM.
<whitequark> but the technique itself doesn't have to be limited to just lexers, ofc.
<pippijn> you want a sentence generator?
<whitequark> that would be a complementary task
<whitequark> however, it'd be useless for me, because I have no authoritative lexer to compare from.
<pippijn> "what is the shortest token sequence that leads to a certain state"?
<whitequark> no
<whitequark> not really.
<whitequark> I want instrumentation for the lexer which would record when transitions happen, and highlight those (on the transitions graph) which never happened
<whitequark> basically.
<pippijn> ah
<pippijn> I can implement that in re2ml :)
<pippijn> that's easy
<whitequark> hm, now that I said it... I can probably screw some bolts together in ragel
<whitequark> pippijn: hehe, if only I was rewriting ruby/parser in ocaml
<whitequark> I'm not a fan of complex and nondeterministic lexers, like, AT ALL
<whitequark> so Foundry doesn't have one
<pippijn> me neither
<pippijn> I made one, once
<whitequark> makefile?
<whitequark> or no
<pippijn> similar
<whitequark> well, it's not exactly complex
<pippijn> it's not complex
<pippijn> and it's deterministic
<pippijn> but it's not regular, at all
<pippijn> whitequark: yeah, that's a lot
darkf has joined #ocaml
<pippijn> who recommended ruby guard to me?
<whitequark> had to translate it from japanese
<whitequark> pippijn: I did
<pippijn> ok
<pippijn> a question
<whitequark> well, not me, but I've used it and can answer questions
<pippijn> what happens if a file is deleted and then created
<pippijn> vim does that
<pippijn> sometimes it can take seconds before the file exists again
<whitequark> hm
<pippijn> actually a new one is first created, then the old one is deleted, then the new one is renamed to the old name
<whitequark> this should work according to https://github.com/guard/guard/issues/297
<pippijn> that's a problem, because make will be called too early
<whitequark> does it not work in practice?
<pippijn> I don't know, I haven't met this problem yet
<pippijn> in practice, it won't happen often
<pippijn> but I know when I have heavy I/O load, it happens to me sometimes
<pippijn> even with manual make invocation
<whitequark> guard uses inotify
<pippijn> I type :w in vim, switch windows, type "make", and it fails because the file is not there yet
<whitequark> so it won't randomly coalesce two distinct events to one
<whitequark> it should be deterministic.
<pippijn> right
<pippijn> ok, so guard is not better than inotifywait
<whitequark> pippijn: I said "randomly"
<pippijn> ah
<whitequark> from what I see in the issue, it does coalesce them
<whitequark> always, that is.
<pippijn> "However, Ruby is not an ordinary language and meanings can change significantly depending on the presence of spaces"
<pippijn> that is terrible
<whitequark> that totally is
<pippijn> This seems to be really disliked by some.
<pippijn> I'd be one, if I used ruby
<whitequark> well again, it causes surprisingly little problems in practice.
<whitequark> *few
<pippijn> yes
<whitequark> the parser is really very well-tuned
<pippijn> I know.. once you are freaked out a couple of times
<pippijn> just like javascript and its semicolon insertion
<whitequark> oh, it's much more regular
<whitequark> in fact, before I started to work on parser, I don't think I triggered an unexpected behavior in the parser even once
<whitequark> in five or so years writing ruby
<pippijn> ok, that's good
<pippijn> perl is weird, too
<pippijn> and I like perl
<pippijn> I can get over it
<whitequark> ruby is orders of magnitude more regular than perl
<pippijn> perl is probably even weirder
ggole has joined #ocaml
<pippijn> yes, I guess so
<whitequark> in fact where it isn't, it often suffers from perl ancestrance :p
<whitequark> also, awk
<whitequark> it's being deprecated, but not quickly.
<whitequark> e.g. ruby has proper scoping, and it has almost zero methods which access environments across scopes
<whitequark> (binding, block_given?, local_variables and caller)
<whitequark> and its OO is the most amazing OO system I've ever worked with. it's better by far margin than C++/Java/C#, better than Smalltalk, and better than OCaml's
<whitequark> better as in more expressive.
<whitequark> because of two key features: you can conveniently (sic) introspect everything at any moment, and it is very simple and idiomatic to forward (possibly mutate) messages
<whitequark> the idea of Foundry is to write a static language which retains 80% of this flexibility :)
ttamttam has joined #ocaml
<whitequark> s,mutate,transform, above.
jcao219 has quit [Ping timeout: 256 seconds]
csakatok_ has joined #ocaml
ttamttam has left #ocaml []
csakatoku has quit [Ping timeout: 248 seconds]
<pippijn> well
<pippijn> now my build system is awesome
<whitequark> added guard ?
<pippijn> no
<pippijn> I made my own guard
<pippijn> the thing is
<pippijn> omake already supports file system notifications
<pippijn> but it doesn't follow symlinks
<pippijn> and I didn't find the place in the code where to make it follow symlinks
<pippijn> now, I force a notification on the symlink itself every time a file in the source tree changed
<pippijn> (I'm doing a vpath build, that's why)
<pippijn> now it doesn't need to stat() every file on rebuild
<pippijn> I have 4040 files in src/
<whitequark> oh yes, venerable stat()
<whitequark> put them all on tmpfs ;)
<whitequark> and build products
<whitequark> hell, put your whole system on tmpfs, that'll work well
<pippijn> it doesn't matter
<whitequark> (I know a dude with 64G ram. his rig compiles linux in about 3s.)
<pippijn> it's not about I/O
<whitequark> hm
<pippijn> because the whole source tree is already in the cache
<pippijn> it's about doing 4040 syscalls
<pippijn> and with 4K that's ok
<whitequark> I recall that stat() did something related to IO
<whitequark> maybe updated access time? not sure
<whitequark> no, probably not.
<whitequark> I'm probably mistaken
<pippijn> but it takes more and more time
<pippijn> with a source tree with 20K files, that will take a long time
<pippijn> now, with notify, it takes constant time
Snark has joined #ocaml
emmanuelux has quit [Quit: emmanuelux]
<whitequark> is it possible to 'rewind' a Lexing.lexbuf ?
<whitequark> or, which is for my case exactly same, add lookahead?
<ggole> No
<whitequark> I see
<ggole> In general that would require the fill function to regenerate information that might simply not exist any more
<ggole> It might be reading from a pipe, say
<whitequark> suspected that.
<whitequark> well, with lookahead it can know to cache it.
<ggole> You really need lookahead in the *lexer*? O_o
* whitequark ducks
<whitequark> Ruby corrupted my brain.
<whitequark> well, I won't do that :p
<whitequark> how would you implement a lexer with multiple states?
<ggole> You could have an "ambiguous" lexeme with enough information for both uses and figure it out in the parser, I guess...
<whitequark> ggole: oh, that would suck even more
<ggole> Sure
<ggole> That's because what you are doing is pretty awful :p
<whitequark> besides, the whole idea is to dispatch to different states depending on lookahead
<whitequark> so that won't really quite work
<whitequark> yeah :D
<whitequark> ggole: ok, back to multiple states
<whitequark> I want it because string quasiquoting
<ggole> The lexer can invoke subroutines
<ggole> Can that handle your situation?
<whitequark> I know, but it's not enough in this case
<ggole> (It's for nested comments and the like
<whitequark> lemme explain
<ggole> )
<ggole> Ah :(
<whitequark> I want strings like this: "the value is: #{ 5 + 5 }"
<whitequark> ... oh. this is going to be painful.
<whitequark> ok. the general idea is to lex ", emit Tk_DQUOTE and transition to read_string
<whitequark> read_string reads all non-#{ stuff into buffer byte by byte (I suppose)
<whitequark> and when it encounters #{, it switches back to read_expr
<ggole> That does sound problematic
<whitequark> I can imagine that all lexers will have the same signature, so I could return the "lexer subroutine for next lexeme" along with the token
<whitequark> or
<ggole> Because you want to return the entire literal from your lexer as one thing, correct?
talzeus has quit [Remote host closed the connection]
<whitequark> I can make a larger automata around the lexers, and dispatch it based on tokens
<whitequark> ggole: no, because I want the exact opposite
<ggole> But that involves invoking the parser on the bit within the #{}
<whitequark> I want it to be broken token-by-token
<pippijn> you can pass a lexing state
<ggole> So you'll send "the value is: ", <expr>, ""?
<pippijn> and mutate it within the lexer functions
<pippijn> that can hold a stack
<pippijn> of lexer functions
<whitequark> ggole: smth like Tk_DQUOTE, Tk_STR_CONTENT "the value is: ", Tk_INTERP, Tk_INT 5, Tk_PLUS, Tk_INT 5, Tk_END_INTERP, Tk_DQUOTE_END.
<pippijn> you can push the next lexer function onto the stack, and dispatch it in the lexer entry point
talzeus has joined #ocaml
JcGood has quit [Ping timeout: 248 seconds]
<whitequark> pippijn: that sounds about right
<ggole> I see
<whitequark> but I don't really see the API to do it?
<pippijn> whitequark: you can pass arbitrary arguments to lexer functions
<pippijn> rule token arg1 arg2 = parse
<whitequark> pippijn: oh, makes sense
<whitequark> thanks
<whitequark> all of you are very helpful <3
ulfdoz has joined #ocaml
<whitequark> string literals can be modified in place O_o
<whitequark> this sounds like a bug factory
<pippijn> in my code, I generally treat strings as immutable
introom_ has joined #ocaml
<ggole> It would be nice to have separate mutable byte arrays and strings
Watcher7 is now known as Watcher7|off
<whitequark> yeah
<ggole> (Possibly with some fast conversion tricks)
<whitequark> I can see the value of existing setup, e.g. jruby spends a *lot* of time copying string literals
introom has quit [Ping timeout: 256 seconds]
<pippijn> yes
<pippijn> ggole: you can make a module for it
<pippijn> with type t = private string
<pippijn> or opaque type t
introom_ has quit [Remote host closed the connection]
<ggole> There's Buffer already which does some of the job
pootler__ has quit [Ping timeout: 248 seconds]
pootler_ has quit [Ping timeout: 248 seconds]
<pippijn> yes
<pippijn> that's true
introom has joined #ocaml
<ggole> The real problem is that existing interfaces use strings everywhere
<pippijn> I find it easy enough to treat strings as immutable
<ggole> The Unix module is an obvious offender
<pippijn> almost all those interfaces do the same
<pippijn> right, Unix fills string buffers
<pippijn> that's ok
<pippijn> Unix is low level
<pippijn> it fills byte arrays
<pippijn> Unix isn't a functional interface, anyway
ulfdoz has quit [Ping timeout: 246 seconds]
f[x] has quit [Ping timeout: 264 seconds]
<adrien> IO isn't functional anyway :P
<whitequark> but monads!
yacks has joined #ocaml
<adrien> and for strings with unix; don't forget you have mmap() in Bigarray
skchrko has joined #ocaml
mfp has quit [Ping timeout: 252 seconds]
djcoin has joined #ocaml
zpe has joined #ocaml
mcclurmc has joined #ocaml
talzeus has quit [Remote host closed the connection]
mfp has joined #ocaml
talzeus has joined #ocaml
talzeus has quit [Remote host closed the connection]
zpe has quit [Ping timeout: 260 seconds]
talzeus has joined #ocaml
<adrien> wmeyer: I'll try to get all the "safe" patches in this week; then we can concentrate on the slightly more complicated ones
Patchou has quit [Read error: Connection reset by peer]
Patchou has joined #ocaml
raichoo has joined #ocaml
cago has joined #ocaml
hkBst has joined #ocaml
hkBst has quit [Changing host]
hkBst has joined #ocaml
mika1 has joined #ocaml
osa1 has joined #ocaml
sgnb` is now known as sgnb
Derander has quit [Read error: Operation timed out]
milosn has quit [Ping timeout: 248 seconds]
thelema_ has joined #ocaml
PM has quit [Ping timeout: 246 seconds]
gautamc has quit [Ping timeout: 248 seconds]
BiDOrD has quit [Remote host closed the connection]
hyperboreean has quit [Ping timeout: 260 seconds]
cow-orker has quit [Ping timeout: 248 seconds]
Derander has joined #ocaml
BiDOrD has joined #ocaml
milosn has joined #ocaml
hyperboreean has joined #ocaml
cow-orker has joined #ocaml
thelema has quit [Ping timeout: 256 seconds]
ccasin has quit [*.net *.split]
osa1 has quit [*.net *.split]
talzeus has quit [*.net *.split]
Snark has quit [*.net *.split]
ggole has quit [*.net *.split]
lenstr has quit [*.net *.split]
stevej has quit [*.net *.split]
so has quit [*.net *.split]
noplamodo has quit [*.net *.split]
transfinite has quit [*.net *.split]
wmeyer has quit [*.net *.split]
xenocons has quit [*.net *.split]
mal`` has quit [*.net *.split]
hto has quit [*.net *.split]
introom has quit [*.net *.split]
darkf has quit [*.net *.split]
kanibe has quit [*.net *.split]
jbrown__ has quit [*.net *.split]
rgrinberg1 has quit [*.net *.split]
olasd has quit [*.net *.split]
zzz_ has quit [*.net *.split]
Netfeed has quit [*.net *.split]
bernardofpc has quit [*.net *.split]
mehdid has quit [*.net *.split]
thizanne has quit [*.net *.split]
Asmadeus has quit [*.net *.split]
Fnar has quit [*.net *.split]
deavid has quit [*.net *.split]
bacam has quit [*.net *.split]
gasche has quit [*.net *.split]
brendan has quit [*.net *.split]
jdoles has quit [*.net *.split]
tlockney has quit [*.net *.split]
hyperboreean has quit [Changing host]
hyperboreean has joined #ocaml
sgnb is now known as Guest21170
PM has joined #ocaml
zpe has joined #ocaml
osnr has quit [Quit: Leaving.]
gautamc has joined #ocaml
osa1 has joined #ocaml
talzeus has joined #ocaml
introom has joined #ocaml
Snark has joined #ocaml
ggole has joined #ocaml
darkf has joined #ocaml
kanibe has joined #ocaml
jbrown__ has joined #ocaml
lenstr has joined #ocaml
stevej has joined #ocaml
so has joined #ocaml
mehdid has joined #ocaml
rgrinberg1 has joined #ocaml
olasd has joined #ocaml
noplamodo has joined #ocaml
thizanne has joined #ocaml
Asmadeus has joined #ocaml
transfinite has joined #ocaml
wmeyer has joined #ocaml
Fnar has joined #ocaml
zzz_ has joined #ocaml
xenocons has joined #ocaml
mal`` has joined #ocaml
Netfeed has joined #ocaml
bernardofpc has joined #ocaml
deavid has joined #ocaml
hto has joined #ocaml
jdoles has joined #ocaml
ccasin has joined #ocaml
bacam has joined #ocaml
gasche has joined #ocaml
brendan has joined #ocaml
tlockney has joined #ocaml
thomasga has joined #ocaml
wagle has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
zpe has quit [Ping timeout: 256 seconds]
wagle has joined #ocaml
<whitequark> is it not possible to add code above menhir's declaration of token type?
mfp has quit [Ping timeout: 240 seconds]
f[x] has joined #ocaml
thomasga1 has joined #ocaml
Guest21170 is now known as sgnb
<gasche> whitequark: according to the manual, you can put %{ ... %} headers anywhere in the file
<gasche> hm
<gasche> more precisely, anywhere before the first %% separator
<gasche> so you can do %{ ... %} %token ... %{ ... %} %%
thomasga has quit [Ping timeout: 248 seconds]
ontologiae has joined #ocaml
<whitequark> gasche: doesn't work: it still adds that code after type token = ...
<whitequark> so I can't use the newly defined type in tokens.
<whitequark> I had to extract another module, Lang, on which both parser and lexer depend.
mfp has joined #ocaml
stevej has quit [Ping timeout: 268 seconds]
<whitequark> pippijn: one good thing in ocaml is that an identity function can just return its argument regardless of type
<whitequark> however that also turns bad when you want to pass around stuff which doesn't fit into a tagged word
<whitequark> so, it turns out that C++-like approach is more flexible, if results in some bloat.
<pippijn> whitequark: sure
<pippijn> so, use ATS
<pippijn> which has both
ttamttam has joined #ocaml
<whitequark> heh
<whitequark> isn't it also a complete PITA to use?
<pippijn> it's ugly (in my opinion)
<whitequark> I think that stuffing a lot of invariants to your type system isn't that good of an idea
<whitequark> you essentially turn it into a collection of whatever ad-hoc constraints you wanted
<pippijn> I like that :)
<whitequark> :D
<pippijn> I like coq
<ousado> it solves real problems. and the feature-set of ATS is pretty unique
<whitequark> ousado: not saying it's useless. saying it's... not for everyone. by a far margin.
<pippijn> t@ype
<whitequark> and the skillset required to successfully use ATS diverges with the skillset required otherwise in embedded work (perhaps this is bad, but this is how it is).
zpe has joined #ocaml
<ousado> sure, the skillsets required to use more as opposed to less advanced languages diverge. that's not only true for embedded work.
osa1 has quit [Quit: Konversation terminated!]
thomasga has joined #ocaml
thomasga1 has quit [Read error: Connection reset by peer]
zpe has quit [Ping timeout: 248 seconds]
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
Simn has joined #ocaml
osnr has quit [Ping timeout: 248 seconds]
UncleVasya has joined #ocaml
thomasga has quit [Ping timeout: 248 seconds]
<gasche> whitequark: I *suppose* this may be a menhir bug
q66 has joined #ocaml
<gasche> indeed
<gasche> I have a small repro case
<gasche> sending this to menhir's dev right now
<whitequark> gasche: thanks!
thomasga has joined #ocaml
<gasche> I got quick feedback
zpe has joined #ocaml
Kakadu has joined #ocaml
<gasche> the maintainer is not conviced it's a bug (of course that's an excuse for not doing anything)
<gasche> so you should keep your workaround for now (which is probably a better organization in the long-term anyway)
<whitequark> I see.
<gasche> but maybe you or I could get motivated enough to submit a patch to fix that
<gasche> which has good chances of being accepted if it is not ugly
<whitequark> I'll look into it later.
ttamttam has quit [Read error: Connection reset by peer]
<pippijn> gasche: what is the case?
ttamttam has joined #ocaml
<gasche> I need more context to understand your question
<pippijn> 10:45 < gasche> I have a small repro case
<pippijn> what is the bug?
<gasche> ah
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
<gasche> the type (t) declared above the token declaration is put below it in the generated source file
<gasche> that should be *rather* simple to fix (not trivialy as the header-collecting structure is probably unordered right now, so that would require a change of representation)
<gasche> but I have never played with menhir's source code
<pippijn> I see
<pippijn> let me check
<pippijn> btw
<pippijn> gasche: I think that is useless
<pippijn> gasche: type t is not emitted into the .mli
<pippijn> so the resulting parser function can never be compiled
ttamttam1 has joined #ocaml
weie_ has quit [Read error: Connection reset by peer]
ttamttam has quit [Ping timeout: 246 seconds]
<pippijn> I don't need to check
<pippijn> you can't do this..
weie has joined #ocaml
<pippijn> if you wanted to do this, menhir would need to know what part of the %{ %} is mli and what is ml
<gasche> hm
<gasche> isn't the .mli produced by something like (ocamlc -i) ?
<gasche> that's what I assumed
mort___ has joined #ocaml
<pippijn> no
<pippijn> that would be bad
<pippijn> because the .ml has lots of small functions
<pippijn> for every state
<gasche> ah
<gasche> well, you could probably tune menhir-side code generation to not reveal them at toplevel
mcclurmc has quit [Ping timeout: 240 seconds]
<pippijn> what do you mean?
<pippijn> ah
<gasche> but arguably even the functions people usually put in their %{ ... %} are auxiliary stuff that doesn't belong in the public interface
<pippijn> then it would be noticably slower
<gasche> I don't think so if their are still closed
<gasche> s/their/they/
<pippijn> sorry
<gasche> in any case, that is a valid point you make, about .mli subtleties
<pippijn> let () = let s1 a = ... in let s2 a = ... in ()
<pippijn> blah
ccasin has quit [Ping timeout: 245 seconds]
<pippijn> it is slower
<pippijn> I have tested it
<pippijn> because I wanted to do something like you suggested
<pippijn> in a different setting
<pippijn> and I found, local functions, even if they don't close over anything, are slower
<pippijn> toplevel functions are the fastest
<gasche> do you still have your concrete example around? I am fairly surprised that lambda-lifting don't make them equivalent
<pippijn> no
<pippijn> let me check
ccasin has joined #ocaml
<pippijn> for example, https://paste.xinu.at/Vyfz/ocaml
<pippijn> addAdditionalSiblingLink is only used in the function below it
<pippijn> so I wanted to put it inside
<pippijn> it is slower that way
ocp has joined #ocaml
<ggole> I've noticed that local functions can result in useless work
<pippijn> maybe let parse = let state1 lexbuf stack = ... in let state2 lexbuf stack = ... in fun lexbuf -> ...
<pippijn> might be the same, I'm not sure
<ggole> I assume that either there is no DCE, or it is run at the wrong time
<gasche> pippijn: could you provide an example I can compile and test?
<ggole> movl$camlTest2046FuK__4, %eax
<ggole> lea1(%ebx, %ebx), %eax
<ggole> ^ totally useless load
<pippijn> gasche: maybe, but not now
<pippijn> if I think about it later, I will
<pippijn> or if you remind me later
lopex has joined #ocaml
IbnFirnas has joined #ocaml
osnr has joined #ocaml
<ggole> gasche: http://ocaml.nopaste.dk/p50329 is a trivial example
<gasche> note that I'm only considering closed subfunctions
<gasche> not closures
osnr has quit [Ping timeout: 252 seconds]
<ggole> The second example is closed
<gasche> does it have a non-neglectible performance disadvantage over the first one?
<gasche> I'm not talking about producing assembly code that is not as nice
<gasche> but actual time
<ggole> Doubtful
<ggole> The waste of code space is annoying though
<gasche> (Playing with compiler optimizations taught me that 80% of the simplifications of the assembly code were made irrelevant by processor-level cleverness)
<gasche> besides
demonimin has quit [Ping timeout: 245 seconds]
<gasche> It is bad to make style decisions based on optimisations details that may change in the future
<pippijn> in my case, it was noticably slower
<gasche> I think that some performance-style decisions are robust to minor optimizer changes/improvements (eg. favoring tail-rec versions when they occur no additional work)
<pippijn> not much
<pippijn> a few %
<gasche> but some are too fragile
<pippijn> but consistently slower
demonimin has joined #ocaml
<whitequark> can someone criticize my lexer? https://gist.github.com/whitequark/63f344b33b7e27930069
<whitequark> it should be complete
<pippijn> lexer_stack :)
<pippijn> exactly the same name as I had for my lexer stack
<whitequark> pippijn: yes. :D
* whitequark renames it to cage_of_tomatoes
<whitequark> science is about why not! *ahem*
<pippijn> personally, I prefer Parser.Id_IVAR (locate lexbuf, i)
<pippijn> whitequark: good
<whitequark> oh, right, it's valid
<pippijn> besides that, I like it
<ggole> Why the all caps constructors?
<whitequark> ggole: I'm used to token names from Ruby's lexers
<ggole> (Not a big deal, just not really idiomatic in OCaml)
<ggole> Right
<whitequark> tPERCENT isn't a valid constructor so I made up something
<pippijn> I also do that
<pippijn> for token names
<ggole> I used it do it, coming from C
<pippijn> but only for token names
<pippijn> I think that's not bad, then you know it's a token :)
<whitequark> pippijn: ok. thanks :) now to figure out menhir's new features (parametric actions)
<whitequark> seems like it can cut the parser's length considerably
<pippijn> whitequark: those are awesome
<pippijn> not really a new concept
<pippijn> but it's nice that they implemented it
<whitequark> not new?
<whitequark> huh, it's the first time I see them anywhere
<ggole> whitequark: pretty readable: I'd consider less List.hd and List.tl and more matching, but a match failure would probably just be a bug there
<whitequark> anywhere: yacc, bison, antlr, ...
<whitequark> ggole: yeah, I want the exceptions
Neros has quit [Ping timeout: 264 seconds]
<pippijn> you get exceptions if you put a refutable pattern there
<pippijn> but you also get a compiler warning
<gasche> given that we apparently have a lot of people interesting in yacc-style parsers right now
<ggole> assert false would be more informative if you are looking for bugs
<ggole> But it is OK as is
<gasche> let me note that I would be interested in whether OCaml's ocamlyacc parser could be improved to provide better error messages
<ggole> (List.hd failure won't give you source locations)
<gasche> I think there would be room for contribution on this point
<pippijn> gasche: have you seen my menhir patch?
<whitequark> ggole: um, what about that command-line key which enables backtraces?
<pippijn> I'm not very interested in ocamlyacc
<whitequark> it's pretty futile to debug stuff without backtraces anyway
<gasche> but the devs are a bit wary of parser changes -- in particular, working with error tokens may change the automaton state and *possibly* introduce conflicts
<gasche> pippijn: no I have not
<pippijn> but I'm sure it could be improved just as easily as menhir
<ggole> whitequark: you can use that, yeah: but often you are in the toplevel or just haven't turned it on
<gasche> but I don't think it's a viable medium-term option to use menhir in the OCaml distribution
<ggole> assert false will reliably say "the bug is here"
<companion_cube> because it's in OCaml and not C, right?
<ggole> Again: I don't think it is a big deal
<gasche> companion_cube: that, and generally it makes for an invasive change
<pippijn> the only thing ocamlyacc needs to do is pass token/state information in its exception
<whitequark> ggole: sure. I'm actually wondering why backtraces aren't on by default
<pippijn> then the client code can do the rest
<ggole> (I would *really* like to be able to turn backtraces on in the toplevel)
<ggole> It's a performance hit
<whitequark> it's basically the behavior of every single other language out there
<whitequark> default behavior*
<pippijn> gasche: that C parser was made with menhir+patch
<gasche> whitequark: it's an ironic point
<ggole> Note that many of the stdlib data structures use exceptions to return information (stuff like Not_found is everywhere)
<gasche> OCaml exceptions are *really* fast so people use them a lot
<gasche> so turning on backtraces result in a large performance hit
<ggole> If they required construction of a backtrace, they would not be fast
<gasche> while most other languages don't see as much of a difference
<whitequark> gasche: ah, that's why ocamllex docs recommend using exceptions for control flow
<pippijn> ocaml exceptions are indeed *really* fast
<ggole> It would be beneficial if you could say bug "aargh %s" bug_info and get a backtrace every time...
<gasche> pippijn: what does you patch do, and did you submit it upstream?
<pippijn> funny, gasche
<pippijn> I talked about this earlier today :)
<whitequark> ggole: and assert is a compile-time construct which doesn't give you a backtrace either
<gasche> hm
<whitequark> just a location
<pippijn> wait
<ggole> whitequark: it gives you the location
<ggole> Which isn't much, but it is better than failure "empty list"
<whitequark> right. well, that explains some patterns I've seen
<whitequark> good to know.
<ggole> You start your million line ocaml program. It replies: Not_found.
<gasche> ok pippijn so you're in the process of discussing the changes with François
<ggole> Where do you start looking?
<pippijn> gasche: the patch does exactly that: raise StateError (state, token)
<whitequark> ggole: I like how this is perfectly in line with the compiler behavior.
<gasche> pippijn: but how is the caller supposed to make sense of menhir's internal states?
<pippijn> in 2 ways
<whitequark> (well, the compiler *does* give you the location but seldom explains what it *wants* there.)
<pippijn> 1) using the parser.automaton dump, it can find out what tokens are expected in a state
<gasche> whitequark: I'm interested in improving error messages
<ggole> whitequark: hmm? You mean assert messages?
<pippijn> 2) using samples, it can map state/token pairs (or just states) to error messages
<whitequark> gasche: I think an excellent and simple start would be to show an excerpt, clang-style
<whitequark> gasche: this really helps if you aren't using an IDE
<gasche> whitequark: do you have a concrete example?
<gasche> I have the luck of not using Clang
<whitequark> just highlight the range
<whitequark> which it displays and traces anyway
<whitequark> ggole: I mean that both asserts and compiler errors show little, comparatively to other languages :)
<gasche> the toplevel does that
<whitequark> was just a snark.
<gasche> whitequark: but if you enable backtraces, they do
<ggole> Mmm.
<gasche> assert failures
thelema_ has quit [Ping timeout: 248 seconds]
<ggole> The backtraces you get in a lisp toplevel are quite wonderful in comparison.
<whitequark> gasche: see discussion above about backtraces and perf
<whitequark> I understand how the system works and how did we get here. I just don't like it very much, for outlined reasons.
<gasche> whitequark: do you mean you decide not to enable backtraces when you want to debug something?
<pippijn> whitequark, gasche: https://paste.xinu.at/E3gJBw/
<whitequark> gasche: no, it's just strange that they aren't enabled by default
<gasche> hm
<ggole> I think the exception thing is fine as long as you can turn on the information
<ggole> But in a toplevel, you cannot
<ggole> (There's a patch, but it should just be *there*)
<gasche> ggole: did you look at whether there existed feature requests to allow an equivalent of -g in the toplevel?
<gasche> hm
<gasche> a patch? where?
mcclurmc has joined #ocaml
<ggole> Uh, a third party I believe
<whitequark> pippijn: did you replicate clang's output? :)
<ggole> I don't have the link to hand: one moment
<gasche> pippijn: do you think your approach gives better-quality messages than using the ERROR token the standard way?
<pippijn> gasche: no
<gasche> (it does have the advantage of not changing the grammar at all, if I understand correctly what you suggest, but it also seems more invasive)
<pippijn> I think you can, with a lot of effort, get the same quality messages either way
<gasche> (code-length-wise)
<pippijn> but my approach is a lot less effort
<ggole> (I have not used this patch.)
<pippijn> and you can have basic error messages with no effort at all
<whitequark> how do I enable debugging with ocamlbuild? cflag(-g) in _tags ?
<gasche> pippijn: and you're confident that could be done with ocamlyacc as well?
<adrien_oww> whitequark: "debug"
<adrien_oww> the tag
<gasche> whitequark: -tag debug or foo.d.byte
<pippijn> I haven't seen the code, but all it needs to do is pass two numbers with its exception
<gasche> (or foo.d.native)
<pippijn> and it should know those numbers in the error state
<whitequark> thanks
<ggole> Speaking of foo.d
<ggole> I must prepare some
<ggole> Chat later o/
<whitequark> same here
<pippijn> gasche: the error token can be used for error recovery
<pippijn> my approach can't be used for that, at all
<pippijn> once your outside the parser, you can't get back in
<pippijn> with my approach, you get 1 error at a time
<pippijn> with error recovery, you can get many
<gasche> that's an interesting point
<gasche> but error recovery seems even more ambitious than good error messages
<pippijn> you can drop tokens until you find something you can parse, add an error-node to the AST and continue
<gasche> so maybe for the OCaml compiler, it's not a design choice to make now
<pippijn> ah yeah, for the ocaml compiler
<pippijn> I have a tool called merr (make error messages)
<pippijn> it contains a part called automerr, which uses the automaton dump
<pippijn> and another part uses code samples
<pippijn> the code samples are passed to the parser, which prints (state, token) to stdout
<gasche> you should write a blog post about your error explanation work
<pippijn> for the error
<gasche> I would link that on reddit/ocaml
<gasche> and that would make a good reference for further discussion :)
<pippijn> ok
<pippijn> I'll do that
foo303_ has quit [Quit: Lost terminal]
mort___ has quit [Quit: Leaving.]
thelema has joined #ocaml
<pippijn> for the code samples thing, you need to put the parser into a tool that can produce the expected output
<pippijn> all my tools (the 3 of them) have a -merr mode that does so
<pippijn> for the above example:
<pippijn> $ _install/bin/cparse -merr test.c
<pippijn> (145, TK_RBRACE)
<pippijn> oh, and..
<pippijn> hehe :)
<pippijn> for the error messages, you don't want to print the internal names for the tokens
<pippijn> so I need a mapping from constructor to description: https://paste.xinu.at/nTY/
<pippijn> and of course, menhir (and ocamlyacc, probably) doesn't like arbitrary string literals in the token description
<pippijn> so.. sed -e s/".*"$//
ollehar has joined #ocaml
gautamc has quit [Read error: Connection reset by peer]
gautamc has joined #ocaml
thelema has quit [Remote host closed the connection]
thelema has joined #ocaml
osnr has joined #ocaml
osnr has quit [Ping timeout: 252 seconds]
<olafurw> This has probably come up but, OCaml and threading, is it an issue? What do you do about it?
<pippijn> olafurw: depends on what you want to do with it
<pippijn> olafurw: if you want to model concurrency, you can use Lwt
<whitequark> is it webscale?
<pippijn> if you want parallel execution of ocaml code, you need separate processes
<olafurw> hehe no project defined yet, I'm just getting to know the language
<pippijn> if you want parallel execution of ocaml and C code (or other external code), you can use threads
<pippijn> that's all, I think :)
<pippijn> whitequark: yes
<whitequark> heh
<olafurw> pippijn: can I define C functions and thread each one and join them at the end then?
<whitequark> pippijn: was referring to http://mongodb-is-web-scale.com/ :)
<whitequark> pippijn: serious question: no parallelism in ocaml code? at all?
<whitequark> that sounds sad.
<pippijn> olafurw: yes
<olafurw> ok, thanks
<pippijn> whitequark: yes, that is sad
<pippijn> and it won't change anytime soon
<whitequark> is there only a single ocaml implementation?
<pippijn> yes
<ggole> Multiple implementations of ML family language tend to be their own thing
<ggole> jocaml, for example
<pippijn> there is caml light, the predecessor of ocaml
<ggole> js_of_ocaml might be considered an alternative implementation if you squint enough
<whitequark> ggole: jocaml seems to be compatible?
<pippijn> js_of_ocaml
<pippijn> that's true
<pippijn> that's a different runtime
<ggole> Yeah, but it exists as an extension of the language and not an alternative impl
darkf has quit [Quit: Leaving]
<whitequark> right
<pippijn> but does js have threads?
<whitequark> js_of_ocaml doesn't seem to be a serious thing
<pippijn> whitequark: why not?
<whitequark> pippijn: no, and will not, likely, ever.
<ggole> There's "web workers"
<ggole> But they are not really threads
<whitequark> ggole: that's multiprocess
<whitequark> it will be a cold day in hell before js gains shared memory
<whitequark> and likely that's for better
<whitequark> concurrency issues are bad enough with the callback spaghetti :]
<whitequark> pippijn: (js_of_ocaml) library support
<whitequark> e.g. unicode support, these days, is a key part of a runtime
<ggole> Clearly the JS VM engineers need to write an autoparallel JIT so it's not an issue
* ggole coughs
mort___ has joined #ocaml
<whitequark> ggole: oh, there are
<ggole> Should be an easy problem, that one.
<ggole> Actually JIT seems like the way to go for autoparallel
<whitequark> JIT is the way to go for anything remotely dynamic, if you have gigabytes of RAM :)
<ggole> Speculative choices instead of conservative ones
<whitequark> why speculative? JIT has rather precise info
<flux> of the previous runs
<flux> not future ones
<pippijn> jit can speculate
<pippijn> on the future
<whitequark> flux: of the current run, for example.
<ggole> Becuase you really want to back out of parallelizing that call that turns out to be an add instruction
<pippijn> and revert things if they turn out wrong
<ggole> So the overhead doesn't kill you
<whitequark> sure sure :)
<ggole> You can do that speculatively: can't really do it conservatively without giving up opportunities
<ggole> I think speculative optimisations are a really interesting idea in general
<whitequark> oh, it's a pretty powerful concept, especially in jvm
<flux> let's say you have an operation that takes t1 time units and returns true/false, and depending on that value you do one of two operations that take time t2
<whitequark> invokedynamic is zero-cost on the fast path
<flux> you could probably just evaluate all three and discard the one value :)
<whitequark> flux: that's what superscalar CPUs do
<flux> whitequark, in a very small scale
<whitequark> (if they have speculative executions, which they most often have)
<whitequark> right
<ggole> You have to be careful with side effects, exceptions, etc
<ggole> Processors have ROBs and stuff for that
<whitequark> ggole: (invokedynamic) for example, its usage immediately allows to turn all constant (pseudo-constant) accesses in JRuby to actual constants
<whitequark> subject to folding
<ggole> Yes, it's programmable inline caching
<ggole> Very cool
<whitequark> yeah.
<ggole> I suspect static languages can benefit from this too
<ggole> Although not in the same places
<whitequark> ggole: they do, for some kind of static
<whitequark> objc relies on inline caching heavily
<whitequark> (static in the sense that it doesn't have JIT, yes)
<ggole> I'd like to play around with a jit to see what kind of speculation you can get away with
<ggole> One example is data structure rewriting
<ggole> Replacing indirect members with their contents
<ggole> In general the semantics are wrong
<ggole> So you can do it speculatively
<whitequark> interesting
<ggole> Fixup might be expensive if you have to crawl the heap... still not sure if that would fly
dsheets has joined #ocaml
<ggole> But it would give languages like Java (or OCaml!) C-like representations if it works out
<whitequark> ggole: I think I've seen papers on similar projects
<whitequark> they had in common the fact that they integrated with GC
<whitequark> i.e. it did fixups while traversing heap.
<ggole> I'm so happy that compilers are sexy again
<ggole> They were boring for twenty years
<whitequark> were they?
<ggole> Yeah
<ggole> You can't really do much with C
<ggole> "Here's a new, slightly less useless alias analysis" *yawn*
<whitequark> ah, in this sense. yeah.
<pippijn> that's a result of better languages becoming more popular
gautamc has quit [Read error: Connection reset by peer]
<whitequark> better *cough*
<whitequark> like JS and Java?
<ggole> Dunno that JS is all that civilised :)
<pippijn> I'm not sure about java
<ggole> (At least it is memory safe.)
<whitequark> ggole: JS is absolutely horrendous
_andre has joined #ocaml
<flux> and now they are coming up with languages that are resource-safeish
<whitequark> but to optimize it, you need to try really ahrd
<pippijn> you need the language to be memory safe if you want to do interesting optimisations
<whitequark> *hard
<ggole> whitequark: {} + [] *giggle*
gautamc has joined #ocaml
<whitequark> pippijn: either that, or allow your compiler to break your programs :p
<pippijn> ggole: let me guess, NaN?
<pippijn> whitequark: yeah
<ggole> I forget which crazy result it is
<pippijn> whitequark: yeah :) I saw that one
<ggole> It's either NaN or "[Object]" or something insane
<ggole> And the other way around is different
<whitequark> ggole: there was a table
<pippijn> ok, it's 0
<ggole> Ah, that's it
<ggole> And the treatment of this. My god, what was Eich thinking?
<whitequark> ggole: to quote him: "I had to come up with something in two weeks, or something even worse would happen"
<whitequark> though, it is likely that he was entirely correct.
<pippijn> whitequark: ah, that's the = operator?
<ggole> Then he proceeded to heavily market his work once it somehow became entrenched.
<whitequark> pippijn: ==, yeah
<pippijn> at least that is symmetrical
<pippijn> + is not
<whitequark> for +, two dimensions is not enough
<whitequark> let's make a four-dimensional graph of operators in javascript.
<ggole> At least it isn't Perl.
<whitequark> it's not a problem that no one could make any sense from it, anyway
<whitequark> ggole: to be at least a bit fair to him, it's really hard to change anything on the web
<whitequark> though I'm not exactly impressed with efforts
<whitequark> ES6 is a typical committee disaster
<ggole> That's partly because the only programmabiliity we have is Javascript!
<whitequark> and asm.js is, well, just *why*
bobry has quit []
<whitequark> it's an unnecessary formalization of emscripten output. why do you market it like a cure for every known bug
bobry has joined #ocaml
ttamttam1 has quit [Quit: ttamttam1]
<Simn> ** Fatal error: In interp.obj, symbol lidate_166 doesn't start with _ or ?
<Simn> <-- what does that mean?
<pippijn> looks like an error from your (windows) linker
<gasche> multi-process parallelism
<gasche> hm
<gasche> wrong time
<Simn> Hmm, fixed after make clean
<gasche> pippijn: your "each token has an attribute" example could be rather easily added to menhir
<gasche> that would desugar to an auto-generated attr_of_token function
<pippijn> yes
<gasche> I'm not sure the maintainer would want that and see the value over a manual %{ let repr_of_token = function ... %}
<gasche> but you should suggest anyway, showing your use-case
<pippijn> I suggested the StateError patch
<pippijn> twice
<pippijn> not for me, I don't care what he does with his code
<pippijn> I have my menhir in github
<gasche> but that's an orthogonal feature, isn't it?
<gasche> (and where is your menhir fork? what other things do you do?)
<pippijn> no other things
<pippijn> I wanted to be minimally invasive
<pippijn> so that my changes could be replayed easily on new upstream versions
<gasche> upstream integration is always better than separately-maintained fork, though
<gasche> (no reproch here, it seems you're doing the right thing)
<pippijn> I have suggested it
<pippijn> once after I finished it, and now again, one year later
<pippijn> I'm not going to suggest the attr_of_token function before the StateError is accepted
<pippijn> and I'm not going to implement it
<pippijn> merr extracts the token names, and sed removes them
<gasche> menhir is in the "It's not my main job so I'd rather not spend too much time on it"-maintenance mode
<gasche> so you have to be a bit pushy
<gasche> whitequark: did you report your UTF8 issue to the js_of_ocaml developers?
<pippijn> last time, he said I could have read-only access to their repository
<pippijn> I didn't get it (and I don't really need it)
jcao219 has joined #ocaml
<whitequark> gasche: I think someone here said that camomile doesn't work on js_of_ocaml
<gasche> that's a developer of the old days, he's a bit stupid about being afraid of letting the world see badly-written commit messages
<whitequark> and there's no unicode in ocaml core, so...
<pippijn> whitequark: yes, because it needs the databases that are not in code
<pippijn> gasche: I see
<gasche> whitequark: so you did not consider investigating further and reporting the need to the appropriate people, and yet you say that js_of_ocaml "is not a serious thing" based on that need?
<pippijn> my commit messages today were often "readme"
<pippijn> because I added or changed a README.md
<pippijn> I started this: https://github.com/pippijn/ucslib
<pippijn> with the plan to have a unicode library that works on js
<pippijn> but I lost interest
<pippijn> I don't need full unicode support
csakatoku has joined #ocaml
<pippijn> character classes, scripts, etc.
<pippijn> not necessary for now
<pippijn> unicode.ml does utfN-ucs4 conversions
<pippijn> oh, actually it just does utf8/32
<pippijn> I didn't bother with utf16
<gasche> whitequark: if you don't report your issues, they're not going to get magically fixed
gbluma has quit [Ping timeout: 246 seconds]
<gasche> pippijn: I *think* the Camomile developer was ready to create a more minimal version of his own library that would be simpler to deploy
<pippijn> also, I'm not smart enough to understand unicode fully :)
jcao219 has quit [Ping timeout: 256 seconds]
<gasche> I'm not sure that is related to the static data or not
<pippijn> and I didn't want to create yet another broken unicode implementation
<gasche> we had a short discussion about this with him a few years ago on batteries-devel
<pippijn> oh
gbluma has joined #ocaml
<pippijn> well the static data could probably be solved easily
<pippijn> by putting it into an ocaml source file
csakatok_ has quit [Ping timeout: 256 seconds]
<pippijn> the js file would then become enormous, though :)
<whitequark> gasche: s,not a serious thing,not mature enough yet,.
<whitequark> bad wording.
skchrko has quit [Quit: Leaving]
<pippijn> btw
<pippijn> does javascript have proper unicode support?
spearalot has quit [Ping timeout: 256 seconds]
<whitequark> it has bits and pieces
<pippijn> what unicode support does (js_of_)ocaml need to be "mature enough"?
<whitequark> e.g. no built-in support for surrogate pairs, despite being ucs-2
spearalot has joined #ocaml
<pippijn> if it's just a unicode string with utf-8/16/32 conversions, that's easy
<whitequark> pippijn: for me, good enough unicode support is: being able to parse utf-8 and ucs-2, and convert between them, and iterate over them.
<whitequark> I don't need databases.
<pippijn> that's easy
<pippijn> me neither (most of the time)
<whitequark> yeah, I know I can just implement the spec
<pippijn> or use this
<whitequark> oh cool
<pippijn> it's probably not terribly efficient
<whitequark> is there a part of ocaml you didn't improve?
<pippijn> but good enough for me
<pippijn> whitequark: no part that was important to me :)
<whitequark> hah
<whitequark> it will translate to horrible JS
<pippijn> yeah
<whitequark> oh wait, no it won't
<pippijn> I think it will
<whitequark> it's only 32-bit
<pippijn> "continuation"
<whitequark> and doubles have 52 bits of precision
<whitequark> the problematic thing is 32x32->64 multiplication
<pippijn> oh
<whitequark> this code might actually be turned into really efficient machine code by the JIT
<pippijn> why would you do that?
<whitequark> if the closures align well enough
<whitequark> pippijn: crypto, hashing, etc
<pippijn> I mean in utf conversions
<whitequark> no reason
<pippijn> right
<pippijn> oh yeah
<pippijn> (* FIXME: I don't know whether these are correct (probably not). *)
<pippijn> in fact, they are wrong
<pippijn> but they don't happen
<pippijn> I forgot to increase the 3 there
<pippijn> there are no utf-8 characters with more than 4 bytes
<whitequark> hmm
<pippijn> also, I just guessed the masks
UncleVasya has quit [Ping timeout: 262 seconds]
<pippijn> anyway, in reality it works :)
<whitequark> nice
ollehar has quit [Ping timeout: 260 seconds]
* whitequark zzz
<pippijn> whitequark: ping
<pippijn> whitequark: you meant utf-16, right?
<pippijn> whitequark: not ucs-2
<pippijn> because ucs-2 doesn't have surrogate pairs
mort___ has quit [Quit: Leaving.]
skchrko has joined #ocaml
<Kakadu> Guys
<Kakadu> are arithmetic expressions a good language to test memoization for parser combinators?
<Kakadu> I'm trying to get profit from storing results in Hashtbl but I don'
<Kakadu> I don
<Kakadu> I don't have a chance where the same parser-function is executed on the same input
<pippijn> hi Kakadu
<Kakadu> hey
<pippijn> Kakadu: https://paste.xinu.at/8hY/
<Kakadu> wrong branch
<Kakadu> Use QtQuick examples in QML directory
<Kakadu> pippijn: ^^
<pippijn> why?
<pippijn> this is my code
<pippijn> I am not working on qml
<pippijn> I'm doing plain qt
<Kakadu> ah, you are not talking about my library?
<pippijn> no
<pippijn> this is my library
<Kakadu> ah, OKay
<pippijn> how do you do signals/slots with ocaml?
<pippijn> in yours
<Kakadu> well, with QtQuick it is not really needed
<pippijn> ah
<pippijn> ok
<Kakadu> btw, I decided that QtWidgets are rather difficult to bind with OCaml
<Kakadu> pippijn: canu make example with kepPressEvent?
<Kakadu> keyPressEvent*
<pippijn> yes
adrien_o1w has joined #ocaml
<pippijn> replace hitButtonO with keyPressEventO
<pippijn> that's the example :)
<Kakadu> but Will Qt know that method was overriden?
<pippijn> yes
<Kakadu> how?
<pippijn> *all* methods are overridden
<Kakadu> ah, I did the same thing :)
<pippijn> if you don't override it, ocaml raises an exception and C++ calls the superclass method
<Kakadu> So, for every Qt class you generate his twin which is used in ocaml?
<pippijn> yes
<pippijn> lots of files :\
<pippijn> takes ages to compile
<Kakadu> really lots
<pippijn> 207 files
<pippijn> but I did this a long time ago
<pippijn> I'm smarter now
<pippijn> I can probably do things better
<pippijn> not sure, though
<Kakadu> do u have QAbstractModel in class list?
<pippijn> no
<pippijn> I have QAbstractItemModel
<pippijn> but I don't have any proper marshalling, yet
adrien_oww has quit [Ping timeout: 256 seconds]
<pippijn> only int and string are marshalled
<pippijn> so it looks like this: https://paste.xinu.at/6XBAkr/
adrien_o1w is now known as adrien_oww
<pippijn> and this is only for QtCore and OtGui
<pippijn> QtGui*
<Kakadu> with signals and slots you can write very simple non-typesafe function connect: qobject -> string -> qobject -> string -> unit
<Kakadu> s/with/for/
<pippijn> yeah, that is a problem
<Kakadu> not really big
<pippijn> not big, no
<Kakadu> also some class definitions may be mutal recursive
<Kakadu> (and should be placed in one file)
<pippijn> hmm
<pippijn> well, I'm not doing anything with that right now
<pippijn> maybe I'll end up putting *everything* in one file
<Kakadu> oh
<Kakadu> me remembers how ocaml have taken 1.5Gb to compile one file
<pippijn> hehe
<pippijn> that's ok
<Kakadu> I can recommend youi to write simple example with ListView, ListModel and a button which adds items to model dynamically. Don't forget to make view autoupdateable when model changes
<pippijn> I'm not going to do that soon
<pippijn> I'm leaving the code there
<pippijn> I still compile it every day, but otherwise I don't do things with it
<Kakadu> Are u against QtQuick?
<pippijn> no, I like it
<Kakadu> Why QtWidgets than?
<pippijn> I'll probably use your thing sooner than I finish my qt binding
<pippijn> I like to do this :)
csakatoku has quit [Remote host closed the connection]
<pippijn> is there any pure-ocaml compression library?
<pippijn> these are all bindings
talzeus has quit [Remote host closed the connection]
<gasche> pippijn: http://www.elliottoti.com/code/zlib/zlib.ml.html does pure-ocaml *decompression*
<gasche> why are you looking for compression? js_of_ocaml considerations?
<pippijn> yes
<gasche> of course there are rather more scholar projects such as https://github.com/martani/Huffman-compression--OCaml-
<pippijn> why scholar?
<gasche> but maybe you could also bind to a JS library?
<pippijn> well, ok, decompression is enough, I think
mort___ has joined #ocaml
<pippijn> I will make a file with zlib-compressed data in it
<pippijn> and in js, I decompress it
<gasche> if you're thinking of those unicode tables, wouldn't a simple run-length encoding do the job?
<gasche> (I have no idea how those table ares but I assume they have lots of blanks)
f[x] has quit [Ping timeout: 248 seconds]
<pippijn> I think so
<pippijn> let me check
<pippijn> gasche: not that many
<pippijn> there are separator @@@@@@ things
<pippijn> but there is a lot of repetition in the character names
<pippijn> "CAPITAL LETTER " something
<pippijn> that would benefit from string compression
<pippijn> lempel-ziv
<pippijn> with appropriately chosen window
<gasche> ok
alxbl has quit [Read error: Operation timed out]
<gasche> pippijn: if you wanted to seriously work on gzip or zip files, camlzip is a library binding but the parsing and writing of gzip/zip files is done in pure OCaml
<gasche> zlib only does the heavy lifting of actually compressing data
<gasche> so that would be a good basis to start from
<pippijn> that's exactly the wrong thing, isn't it?
<pippijn> I don't want to work with files
<pippijn> I just want the pure compressed data in a stringised form in an ocaml source file
alxbl has joined #ocaml
breakds has joined #ocaml
<gasche> indeed
<gasche> I made that point in case someone interested in a variant of your question were to somehow stumble on the IRC logs
<pippijn> ok
<pippijn> :)
<gasche> that said
<gasche> I think you could do simpler than zip-encoding
<Kakadu> I have some newbie question about let rec: http://paste.in.ua/8407/raw/
<gasche> (I have done related things with my students when I wanted to give them data but their only tool available to import it was a caml light... toplevel)
<gasche> pippijn: devise a sensible lexing algorithm that splits words
<Kakadu> I more or less understand what is wrong but I don't guess have to rewrite it
<gasche> then produce a list of tokens where words are not reapeated
<pippijn> yeah, I can do that
<pippijn> just for the strings
<gasche> (eg. you create (int -> string) map on the fly, and serialize the mapping along with the (int list))
<gasche> Kakadu: you mean "and g = memoize f"
<gasche> but yeah, that's difficult
<Kakadu> gasche: ah, this copy&paste
<gasche> you can do ugly tricks such as
<gasche> let f = ref (fun () -> assert false);; let rec h = ... !f ... and g = .... h ...;; f := memoize g;
<gasche> it should also be possible to make that work without mutation
<gasche> something like
<gasche> hm
<gasche> what I had in mind works only if you can rewrite your mutual definition (let rec f () = ... and g () = ...) as (let rec f () = (let g () = ... f ... in ... g ...))
<gasche> that is if you don't need to expose g and can keep it internal to f
<Kakadu> ah, mutation compiles but prolem which I tried to fix not. TT
f[x] has joined #ocaml
mort___ has quit [Quit: Leaving.]
mort___ has joined #ocaml
pootler_ has joined #ocaml
pootler__ has joined #ocaml
<Kakadu> probably my expression parser-function can't get profit from memoization TT
mfp has quit [Read error: Connection reset by peer]
f[x] has quit [Ping timeout: 256 seconds]
pootler_ has quit [Ping timeout: 248 seconds]
pootler__ has quit [Ping timeout: 256 seconds]
<pippijn> implementing unicode formats is more useful than compression
<pippijn> at least someone would potentially use it
<gasche> on the small test example, this is actually not very interesting
<gasche> I mean, not at all
<gasche> input string takes 2659 chars, compressed representation is 3102 chars
<pippijn> hmm
<adrien_oww> there are bindings to libarchive btw
<adrien_oww> and native library for reading tar I think
<pippijn> adrien_oww: not useful for js_of_ocaml
<adrien_oww> ah, right
<nlucaroni> hmm, openDNS seems to be blocking the caml.inria.fr website.
<gasche> in fact, it also doesn't win anything on the full data
<gasche> so I guess that was too naive as a compression attempt
<pippijn> that's odd
<pippijn> gasche: I'll do one, later
<pippijn> I'm almost done with the utf8-16-32 thing
<gasche> :]
mfp has joined #ocaml
<adrien_oww> nlucaroni: you have a way to report it to them?
<nlucaroni> to openDNS? sure
<nlucaroni> malware-block@opendns.com
<gasche> could that be related to the fact that some antiviruses flag the OCaml windows installer as malware?
<nlucaroni> the page doesn't give specifics, but i wouldn't be surprised.
<adrien_oww> gasche: sounds unlikely
<adrien_oww> I think there are metascanners available online
<adrien_oww> could be good to test using them
<avsm> gasche: was there a resolution on the -use-ocamlfind default in ocamlbuild 4.1 in the end?
<gasche> avsm: nothing decided yet
<avsm> gasche: so unlikely to change for 4.1 then?
* avsm is baking in the build scripts for RWO
<gasche> I would still like to do that, but there has been a (to me, surprising) opposition on the bugtracker item and from youh here on IRC
<avsm> you know, i think a lot of ocamlbuild's usability problems are from the ridiculously verbose command line flags
<avsm> ocamlbuild -vf -p core
<avsm> is preferable to
<avsm> ocamlbuild -use-classic-display -use-ocamlfind -package core
<gasche> I don't think I buy the argument
<avsm> you don't type in enough ocamlbuild commands then
<gasche> at least, I personally don't mind writing longer, but more explicit names
<avsm> you can keep those too, just not force them on people (i.e. -v —verbose)
<gasche> I'm open to shortening propositions
<gasche> hm
Drup has joined #ocaml
<avsm> just occurred to me that that's why i dont like -use-ocamlfind
<gasche> (by that I don't mean that I have the authority to make them accepted upstream)
<avsm> not that it's not the default, just that its a pain to type all the time
<gasche> avsm: one idea I had was to mark some flags as automatically enabling -use-ocamlfind
<avsm> its too late for this sort of change for 4.1, i would have thought
<avsm> agh, no more magic :-( that's even harder to reason about
<gasche> I am not sure Damien would mind changes on the ocamlbuild front
<flux> I'll rejoice when it becomes enough to build any properly configured project with plain 'ocamlfind'
<flux> just how it works with make.
<flux> +like
<gasche> flux: could you be a bit more explicit?
<flux> it never quite works to run ocamlbuild from make in the presense of multiple targets
<gasche> what gets wrong?
<flux> gasche, my routine for building a project: ocamlbuild.. hmm, I wonder what do I usually want to build? ok it's foo.byte, it has let main(). now it's doing it.. no, somehow it doesn't find packages, ah yes I need to use -use-ocamlfind..
<flux> compare to: make
<gasche> flux: one of the difference is that today's OCaml code does not explicitly list its dependencies
<gasche> (as opposed to C's #include directives)
<flux> I don't mind having a _tags-file
<gasche> I made a suggestion to consider allowing topfind's directive #require "foo" in OCaml source code (headers) on the wg-platform list
<gasche> but the reception was rather cold
<flux> I mean that I cannot express those two things in it
jcao219 has joined #ocaml
<gasche> I do think it's a very good idea, but I'm apparently alone in that
<flux> I wonder if I can do it in myocamlbuild.ml? but those are not quite composable.
<flux> personally I wouldn't mind even if external dependencies, as you are suggesting, were expressed in .ml files
<gasche> flux: which two things? default targets and packages?
<flux> but it needs some forethought
<gasche> ah
<flux> default targets and -use-ocamlfind
<gasche> so -use-ocamlfind isn't specified in _tags
<ggole> Aren't there tools to extract dependencies?
<gasche> ggole: not at the ocamlfind-package level
<gasche> (and they're broken anyway)
<ggole> Oh :(
<gasche> so
<gasche> would it work to have a use_ocamlfind flag to put in _tags file
<gasche> ?
<flux> gasche, I would definitely use it if there was one
<avsm> yeah, but that doesn't work, does it?
<gasche> in a more general way, it would make sense to have one
<flux> although I don't quite see the harm in it just being the default
<gasche> one flag for each command-line option
<gasche> but as avsm maybe says, I'm not sure that would work
<avsm> since it changes other rules, so it wouldnt fit in with the semantics of _tags as a filler
<avsm> it could work with a vpath for ocamlfind
<pippijn> man
<pippijn> that took longer than expected
<avsm> i.e. anything with ocamlfind would build in _build/ocamlfind/<target>
<avsm> (which we need anyway for %.p.cmx and %.d.cmx to work properly anyway)
Zopieux has joined #ocaml
felix2 has joined #ocaml
tcpc has joined #ocaml
<gasche> I'll admit I don't know what "vpath" are
<tcpc> hi
felix2 has left #ocaml []
<gasche> hm
colbseton has joined #ocaml
<gasche> other idea: have a ocamlbuidfind command (or alias)
colbseton has left #ocaml []
<gasche> maybe
<gasche> if we start having more of those knobs in ocamlbuild, that have global effects like plugins (instead of just translating easily to tags or command-line options), we may need a supplementary semantic concept
<gasche> I wonder if the recently added -syntax support is also such a special-case
<avsm> an ocamlbuildf isn't a bad plan
<avsm> there's precedent with the other compiler bits
<gasche> I'm still not quite sure that we don't rather want -use-ocamlfind to be the default
<gasche> I mean, we could have ocamlbuild and ocamlbuildfind, but who would have interest in using ocamlbuild?
kaustuv has joined #ocaml
<gasche> my understanding of the answer is "mirage, for expert performance reasons" and "oasis, for expert legacy reasons"
<kaustuv> Is it unreasonable to want the Module.() to not increase the indentation level for the stuff inside the () ?
mort___ has quit [Quit: Leaving.]
<gasche> making users pay for those two fairly specific use-cases seems weird
<gasche> kaustuv: doesn't (...) already increase the indentation level?
<kaustuv> Yes, () does increase it. I want it *not* to.
<kaustuv> My particular use case is something like Foo.([ ... a whole bunch of stuff ])
<kaustuv> I don't want the stuff to be indented twice.
<kaustuv> Basically, I want Module.[ ].
<gasche> so you request is rather related to ([...]), or M.[..] or M.{...}
<gasche> (I'm had the need for M.{..} occasionally)
<gasche> You would have to ask the syntax czar on the bugtracker
Zopieux has left #ocaml []
ocp has quit [Ping timeout: 248 seconds]
ollehar has joined #ocaml
<kaustuv> I guess I can file a feature wish for M.[] and M.{}.
demonimin has quit [Read error: Connection reset by peer]
ollehar has quit [Ping timeout: 264 seconds]
demonimin has joined #ocaml
niwong has joined #ocaml
<gasche> avsm, flux: I think we could consider having a "header" in the _tags file that would contain not predicate-filtered tags, but compilation-wide behavioral indications
<gasche> eg. no-hygiene, use-ocamlfind, etc.
<gasche> in a world that solved the plugin issue, we could also indicate which plugin to load there
<gasche> on the other hand, semantically _tags is not really the right place to put this information
<gasche> myocamlbuild.ml would be more appropriate
<gasche> but people don't like to change this file
<gasche> or even have one
<gasche> and for now they don't compose easily
zpe_ has joined #ocaml
f[x] has joined #ocaml
<gasche> yeah I saw that, thank you
<gasche> so
zpe has quit [Ping timeout: 256 seconds]
<adrien_oww> I want to be able to build two packs which have members with the same names
<adrien_oww> without having to use myocamlbuild.ml
<adrien_oww> (that's the summary of what I want)
niwong has left #ocaml []
y has joined #ocaml
<gasche> verification made, it's trivially easy to enable use_ocamlfind in myocamlbuild.ml
y is now known as Guest79149
<gasche> in myocamlbuild.ml, let () = Option.use_ocamlfind := true
<gasche> I would need to check that other features are equally easy to enable
<gasche> and then document that properly in the right plac
<gasche> but that can totally make it to the release, it's just moving stuff and documenting things
csakatoku has joined #ocaml
f[x] has quit [Ping timeout: 252 seconds]
ttamttam has joined #ocaml
<companion_cube> gasche: like, true: use_menhir
<companion_cube> ?
bkpt has joined #ocaml
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
<kaustuv> Does 4.2 ship with something like #ifdef using the new lightweight syntax extensions?
skchrko has quit [Quit: Leaving]
<MarcWeber> kaustuv: Do you know how to combine cppo with camlp4 ?
zpe_ has quit [Remote host closed the connection]
osnr has quit [Quit: Leaving.]
<MarcWeber> Is there a camlp4 parser which can cope with that line 26 in the paste?
snearch has joined #ocaml
raichoo has quit [Quit: leaving]
Patchou has quit [Read error: Connection reset by peer]
ollehar has joined #ocaml
snearch has quit [Quit: Verlassend]
Tamae has joined #ocaml
pootler_ has joined #ocaml
pootler__ has joined #ocaml
snearch has joined #ocaml
<MarcWeber> The second -pp is excuted first ? I would not have expected that.
malo has joined #ocaml
<ollehar> totally off-topic: anyone have experience with SSL together with websockets?
<MarcWeber> ollehar: Why?
cago has left #ocaml []
<ollehar> I have problems :(
<MarcWeber> One IP per domain, unless browser and servers understand a http extension (see wikipedia about how its called)=
<MarcWeber> Except that there is not much which should go wrong
mika1 has quit [Quit: Leaving.]
<zorun> MarcWeber: this isn't related to websockets, isn't it?
hkBst has quit [Quit: Konversation terminated!]
<zorun> and IAFAIK, all recent browsers support this extension
<ollehar> maybe its Lwt_unix.socket, then. hm.
<MarcWeber> ollehar: Anyway: Talk about the problem you experience and people may have a chance to help you.
<ollehar> I use a cgi-script that works as a small websocket server. for each "session", a cgi-script is started and start listen on 8080, then 8081, etc. now I tried switching to SSL in apache, and the websocket won't connect.
dsheets has quit [Read error: Operation timed out]
<ollehar> so perhaps this won't work with SSL:
<ollehar> let sock_listen = Lwt_unix.socket Unix.PF_INET Unix.SOCK_STREAM 0 in
<ollehar> ( from start_websocket function)
<MarcWeber> ollehar: user -> apache -> cgi app ? or in which way does the request get forwarded?
<MarcWeber> ollehar: Does connecting to apache serving a simple test.txt file work using SSL?
<ollehar> yeah, ordinary loading from cgi works
<ollehar> it's just the websocket part
<MarcWeber> Apache acts as proxy starting many cgi apps in your case? But your cpi (ocaml?) app should not bother with SSL then ?
<MarcWeber> the cgi app should only know that it has to return links to https:// urls
<ollehar> (cgi done i OCaml)
<ollehar> sounds reasonable
tcpc has left #ocaml []
<ollehar> this is the error in apache2/error.log: Lwt_stream.Empty[Thu Jun 27 12:44:44 2013] [OcamlNet] /cgi-bin/drakskatten_ajax: Netchannels.Closed_channel (Status 500), referer: https://127.0.1.2/cgi-bin/drakskatten
<MarcWeber> Now CGI is not HTTP(S) protocol usually. Often sockets stdin/out can be used, too - depending on your knowledge (could be wrong this time again ..)
<MarcWeber> ollehar: And without https everything is fine?
<MarcWeber> It looks to me that the cgi app does not receive any bytes
<ollehar> yes, I've been using the websocket cgi for months without ssl
<ollehar> first I was thinking it's a port problem.
<ollehar> like, SSL only listens on 443.
<ollehar> I will ask the programmer of Lwt_websocket, which I use.
thomasga has quit [Quit: Leaving.]
<ollehar> alternatively, I won't encrypt the websocket information.
<MarcWeber> ollehar: http://www.yolinux.com/TUTORIALS/LinuxTutorialCgiShellScript.html shows how to write a minimal shell cgi script. Maybe you want to try replacing the ocaml cgi by such a dummy script to understand more about what fails. Eg the bash script will not care about any stdin
cdidd has quit [Read error: Operation timed out]
amiller_ has quit [Read error: Operation timed out]
cdidd has joined #ocaml
dezzy has quit [Ping timeout: 240 seconds]
dezzy has joined #ocaml
kaustuv has left #ocaml []
Guest61774 has joined #ocaml
Guest61774 is now known as amiller_
<ollehar> MarcWeber: maybe so, thanks for your time!
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
<companion_cube> is there a complexity bound on Map.split?
volumetone has joined #ocaml
volumetone has quit [Client Quit]
<companion_cube> I'd like to find for a key k, in a Map, the value whose key is the lowest key >= k
csakatoku has quit [Remote host closed the connection]
<flux> I would imagine it would be O(lg n)
<flux> what else would it be?
<companion_cube> don't know, could be bigger
raichoo has joined #ocaml
JcGood has joined #ocaml
ontologiae_ has joined #ocaml
ontologiae has quit [Ping timeout: 246 seconds]
Kakadu has quit [Quit: Konversation terminated!]
csakatoku has joined #ocaml
JcGood has quit [Ping timeout: 245 seconds]
Yoric has joined #ocaml
ttamttam has quit [Quit: ttamttam]
ontologiae_ has quit [Ping timeout: 248 seconds]
JcGood has joined #ocaml
csakatoku has quit [Ping timeout: 246 seconds]
thomasga has joined #ocaml
JcGood has quit [Ping timeout: 240 seconds]
mcclurmc has quit [Ping timeout: 252 seconds]
q66 has quit [Quit: Quit]
q66 has joined #ocaml
q66 has quit [Remote host closed the connection]
q66 has joined #ocaml
Tekk_ has left #ocaml []
<adrien> wmeyer: I'll be sending you some work pretty soon
<pippijn> whitequark: https://paste.xinu.at/C2XSl/
<pippijn> whitequark: I think that would be all
JcGood has joined #ocaml
introom has quit [Remote host closed the connection]
q66 has quit [Quit: Leaving]
q66 has joined #ocaml
djcoin has quit [Quit: WeeChat 0.4.0]
ontologiae_ has joined #ocaml
jtbt has joined #ocaml
<wmeyer> adrien: great! thank you.
<adrien> it's awful
<adrien> configure has changed a lot
<adrien> I'm soooo likely to introduce a regression
<wmeyer> yes, it's changing, since we have CI now
<wmeyer> let's see, it's just a build system, the target is trunk at the moment so see no problem
<pippijn> adrien: build system?
<adrien> pippijn: ocaml's
dsheets has joined #ocaml
<pippijn> also, what CI system do you use?
<wmeyer> gerrit&jenkins
<pippijn> ah
<wmeyer> it's not too bad
<adrien> wmeyer: and there are windows slaves?
<wmeyer> yes, there are
kanibe has quit [Ping timeout: 252 seconds]
<wmeyer> dsheets: hi!
<adrien> mingw and msvc?
<pippijn> does ocaml use ocamlbuild?
<adrien> jein
<wmeyer> pippijn: partially, camlp4 uses
<pippijn> ok
<dsheets> wmeyer, hi
<wmeyer> dsheets: didn't get my head around to come to makespace this weekend
jtbt is now known as kanibe
<adrien> wmeyer: and do you know if the "official" mingw stuff is mingw-w64 now or is that only for 64b?
<adrien> (my impression that it was for both bitnesses)
<dsheets> wmeyer, no worries... i didn't go either
<wmeyer> adrien: I think both, but I'd need to ask, isn't it just 64bit?
<wmeyer> i would thought so
<adrien> wmeyer: no, it handles both despite the name
<adrien> and it handles 32b better
<adrien> way better
<adrien> way way way way way better
<wmeyer> ok
<adrien> if mingw.org still has to be supported, it's annoying and I'm going to be unable to test that
<adrien> (I will _not_ install a mingw.org toolchain if I can avoid it)
<wmeyer> sorry, I know so little about this adrien
JcGood has quit [Ping timeout: 276 seconds]
<wmeyer> mingw.org toolchain?
<adrien> there's GCC, binutils, everything and then there are the bindings to the system libc
<adrien> or platform api
<adrien> and groups of people doing the work to support the toolchain on windows
<adrien> 15 years ago there was mingw.org
<adrien> work is not done upstream
<adrien> some of the main contributors are everything but nice
<adrien> API coverage is not that good
<adrien> and for the past 5 years or so, you have mingw-w64
<adrien> which started after a company started open-sourcing its work to have GCC on Windows 64 (their software requires a lot of memory and they have C, java and obj-c in their codebase)
<adrien> but mingw.org refused the contribution
<adrien> on the one hand you have annoying pedantic people you can't work with
<adrien> and with old support
<adrien> on the other hand you have nice people who welcome contribution, work for you and are going forward
csakatoku has joined #ocaml
<adrien> that said, I'm worried about Git
<adrien> the borg might already be among us
emmanuelux has joined #ocaml
csakatoku has quit [Ping timeout: 246 seconds]
mcclurmc has joined #ocaml
<adrien> it feels like git is updating my patch iself =/
ontologiae_ has quit [Ping timeout: 245 seconds]
ontologiae_ has joined #ocaml
<adrien> wmeyer: I've updated the first batch of patches ; I'm going to test them but maybe you want to start checkign them already?
Guest79149 has quit [Ping timeout: 264 seconds]
ttamttam has joined #ocaml
<wmeyer> I'm looking at them now adrien
<wmeyer> ah, yes please attach them to mantis
yacks has quit [Ping timeout: 256 seconds]
<adrien> well, I haven't time to build with them yet but I thought that you could want to start checking them now
<adrien> I'll attach them once they're tested
<adrien> (warning you)
<wmeyer> no need to worry we do it on trunk at the moment, and CI will (hopefuly) catch the build problems
<wmeyer> but yes, testing of course is required
snearch has quit [Quit: Verlassend]
<adrien> wmeyer: enjoy :D
csakatoku has joined #ocaml
ontologiae_ has quit [Ping timeout: 276 seconds]
BiDOrD_ has joined #ocaml
yacks has joined #ocaml
csakatoku has quit [Ping timeout: 264 seconds]
darkf has joined #ocaml
BiDOrD has quit [Ping timeout: 248 seconds]
ttamttam has quit [Remote host closed the connection]
<wmeyer> adrien: hah!
<wmeyer> adrien: Thank you for your work.
<adrien> :-)
breakds has quit [Quit: Konversation terminated!]
Kakadu has joined #ocaml
Watcher7|off is now known as Watcher7
ggole has quit []
<pippijn> gasche: ping
tane has joined #ocaml
jtbt has joined #ocaml
raichoo has quit [Quit: leaving]
kanibe has quit [Ping timeout: 256 seconds]
<pippijn> gasche: I'm tired, I can write more, later
stevej has joined #ocaml
mlh has quit [Read error: Connection reset by peer]
mlh has joined #ocaml
JcGood has joined #ocaml
jcao219 has quit [Ping timeout: 248 seconds]
rgrinberg1 is now known as rgrinberg
Yoric has quit [Ping timeout: 264 seconds]
Armael is now known as Le_Peuple
Le_Peuple is now known as Armael
JcGood has quit [Ping timeout: 246 seconds]
Yoric has joined #ocaml
<whitequark> pippijn: pong. yes, utf-16
<pippijn> whitequark: I have everything now
<pippijn> the code is not so nice in some places
<pippijn> I'll clean it up later
<pippijn> (yes, I will, I'm that kind of person who does)
<pippijn> but it works
<pippijn> I have do exhaustive tests
<pippijn> -do
<whitequark> pippijn: excellent, thanks
<whitequark> I'll try to integrate it with ulex a bit later
<whitequark> I really need unicode literals in Foundry.
<whitequark> (it's unicode-only, duh)
csakatoku has joined #ocaml
<nlucaroni> Anyone aware of a meta-heuristic / global optimization library for OCaml? (Simulated Annealing, VNS, Tabu, ...).
<pippijn> whitequark: why can't you use BatUTF8 and/or camomile?
<whitequark> pippijn: BatUTF8 will pull in the rest of Batteries, right?
<whitequark> I see it depends on BatIO
<pippijn> yes
<pippijn> what is the problem with that?
<whitequark> don't want to pull in a lot of libraries I am not going to use. already have Core here
<pippijn> ok
<wmeyer> adrien: all of them apart one are on trunk now.
<whitequark> mostly same reasoning for camomile (character tables I don't need), plus it won't work with js_of_ocaml.
csakatoku has quit [Ping timeout: 246 seconds]
<whitequark> which is a js_of_ocaml issue, as gasche correctly says, but if I can stick to small and portable solution which is sufficient, I'd do just that.
<pippijn> is that a js_of_ocaml issue?
<pippijn> camomile wants to open databases
<pippijn> what can js_of_ocaml do about that?
* whitequark shrugs
<whitequark> well, emscripten emulates a filesystem :]
<pippijn> right
<pippijn> yes, it can do that
<whitequark> not sure. maybe at some point I will need to do normal form transformations. then I'd have to switch to camomile
<whitequark> so far I'm fine with the simplest thing that works
<pippijn> ok
<pippijn> if you use it and modify it, I would like to know about your changes
<whitequark> sure
<whitequark> likely the first one would be iteration, substring and concatenation functions
<whitequark> oh, you even have the UDB. nice.
<pippijn> oh
<pippijn> whitequark: I don't have iteration, substring and concatenation :)
<whitequark> pippijn: adding them
<pippijn> ah
<pippijn> ok
<pippijn> whitequark: what licence do you use for that?
<whitequark> pippijn: if you want, I can contribute my changes back under MIT
_andre has quit [Quit: leaving]
<whitequark> I generally open-source all (useful) support libraries for products I write under it.
<pippijn> Hi pippijn! You've successfully authenticated, but GitHub does not provide shell access.
<pippijn> is there a way to log into ssh but not request a shell?
<pippijn> I want to stay logged in, so I can use ssh multiplexing
<wmeyer> ssh <host> read
<wmeyer> or something similar
<whitequark> pippijn: -N
<pippijn> nice
<pippijn> whitequark: that works, thanks
<pippijn> it even stays open quite long, nice
<pippijn> it has been open for 15 minutes
<whitequark> argh, mehnir can automagically extract location info from the lexer
<pippijn> yes
<pippijn> ocamlyacc can, too, I think
* whitequark goes back to remove all Location.t from tokens
<pippijn> :)
csakatoku has joined #ocaml
<whitequark> though it's really ugly
<whitequark> why isn't there a function to return a tuple of ($startpos,$endpos)?..
breakds has joined #ocaml
<adrien> gah
csakatoku has quit [Ping timeout: 246 seconds]
<adrien> I like mantis
<adrien> but not for that
osa1 has joined #ocaml
osnr has quit [Quit: Leaving.]
breakds has quit [Quit: Konversation terminated!]
osa1 has quit [Ping timeout: 246 seconds]
Kakadu has quit []
<wmeyer> adrien: I commited the last patch.
Snark has quit [Quit: leaving]
darkf has quit [Quit: Leaving]
jcao219 has joined #ocaml
tane has quit [Quit: Verlassend]
thomasga has quit [Quit: Leaving.]
<amiller_> what's this type
<amiller_> let mk_stream : 'a.(module StreamOps) -> (int -> 'a) -> 'a stream
<amiller_> from oleg's page on first class modules?
ulfdoz has joined #ocaml
<amiller_> 'a.(module StreamOps) i don't understand that syntax, it's obviously not array indexing but what else is .()?
csakatoku has joined #ocaml
<amiller_> i haven't found any exlpanation of it in the module syntax docs
<def-lkb> You can add spaces: 'a . (module StreamOps)
<amiller_> or for that matter let map : 'a . ('a -> 'b) -> 'a stream -> 'b stream
<def-lkb> You can read it as "forall 'a . <type>". It just happens that, to make things more confusing, <type> is a package "(module StreamOps)" (that is, the type of a first class module value)
<amiller_> isn't it implicit
<amiller_> is that the same as (module StreamOps) -> (int -> 'a) -> 'a stream?
<def-lkb> Sometime, the quantifier has to be made explicit.
<def-lkb> With ": (module StreamOps) -> (int -> 'a) -> 'a stream", the typer just check that the type of your value is an instance of this schema.
csakatoku has quit [Ping timeout: 256 seconds]
<def-lkb> (That is, there is an 'a such that the actual type fits this scheme).
<def-lkb> For instance, a value of type (module StreamOps) -> (int -> int) -> int stream would be accepted by the typechecker.
<def-lkb> With an explicit quantifier, the typechecker ensures that 'a is not instanciated in the final type.
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
zpe has joined #ocaml
<amiller_> i see, that works for me
osnr has quit [Quit: Leaving.]
<whitequark> why can't I abstract a function there?
ontologiae_ has joined #ocaml
<Drup> feels like a limitation with variants
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
<whitequark> so, there is... simply no way?
<whitequark> since I can't pass constructors as arguments
<Drup> whitequark: "let (x,y) = bla in Blo (x,y)"
<Drup> is it simple enough ?
<whitequark> Drup: that's for one token (t in my paste = token)
<whitequark> but if there's three, the code quickly becomes unreadable
<Drup> why ?
<whitequark> three nested let..in, duplicated across countless parser rules differing only in constructor name
<Drup> I don't know the context, so I can't really say.
<whitequark> currently it looks like this: http://hastebin.com/rutepugewo.coffee
osnr has quit [Quit: Leaving.]
<whitequark> well, I guess I can squeeze space from other parts of the expression
<Drup> whitequark: change the type of your constructor from t1 * t2 to (t1*t2)
<whitequark> oh, those are not equivalent?
<Drup> not exactly
<Drup> I'm not sure why :/
zpe has quit [Remote host closed the connection]
breakds has joined #ocaml
breakds has quit [Read error: Operation timed out]
<whitequark> ttp://hastebin.com/xakuqoqobe.hs
<pippijn> does anybody here know omake?
<whitequark> what does it not like there?
<whitequark> the warning corresponds to line 18
wmeyer2 has joined #ocaml
<wmeyer2> adrien: it would be worth to integrate also ocaml-android project with your cross compilation patches
breakds has joined #ocaml
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
osnr has quit [Quit: Leaving.]
<whitequark> oh right, I'm doing it wrong.
<whitequark> is it possible to, hmm, apply subtyping to records? say I have several records like this: http://hastebin.com/mamafopiba.hs
<whitequark> I want to have a function which accepts *any* of the above records and extracts the `expression' field
<whitequark> nevermind, figured out how to do it better
<Drup> whitequark: no, but you can use object for that
<whitequark> Drup: don't actually need it. all of the locations above are embedded in the AST like this: http://hastebin.com/bibucajoni.pas
<Drup> (and yes, have multiple record type with the same fields is asking for troubles)
<whitequark> so I can just match the node type
<Drup> having*
<whitequark> or, I can just make all Location.* tuples of (t, { lhs=...; rhs=... })
<whitequark> and this is probably a better idea
Yoric has quit [Ping timeout: 264 seconds]
<whitequark> hm, don't get it
<whitequark> type l = t * t with sexp;; is OK
<whitequark> but type n = t * { foo : t} with sexp;; is Parse error: [type_kind] expected after "=" (in [opt_eq_ctyp])
gautamc has quit [Read error: Connection reset by peer]
<whitequark> oh, record types have to be named, I guess.
<Drup> yes
<whitequark> at least, am I correct that if I have a bunch of types (t * unary_i), (t * binary_i), etc, and a function t * 'a -> t, that function could process them all?
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
gautamc has joined #ocaml
<whitequark> it seems that it should
osnr1 has joined #ocaml
osnr has quit [Ping timeout: 246 seconds]
osnr1 has quit [Quit: Leaving.]
malo has quit [Quit: Leaving]
q66 has quit [Quit: Leaving]
<whitequark> hm, why can't a module use type definitions from its own .mli?..
<ousado> wmeyer2: do you know this? http://www.youtube.com/watch?v=AWcbj7ksqwE
wmeyer2 has quit [Read error: Connection reset by peer]
zpe has joined #ocaml
zpe has quit [Ping timeout: 256 seconds]
ontologiae_ has quit [Ping timeout: 276 seconds]
ollehar has quit [Ping timeout: 276 seconds]
ulfdoz has quit [Ping timeout: 252 seconds]
csakatoku has joined #ocaml
Simn has quit [Quit: Leaving]
structuralist has joined #ocaml
csakatoku has quit [Ping timeout: 276 seconds]