gildor changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 3.12.1 http://bit.ly/nNVIVH
<phao> Hi. Is there some "list" of software known to have been written in ocaml
<phao> ?
<thelema_> phao: caml humps?
<phao> Ahh...
<phao> thre is more than the one sin the page =)
<phao> I thought that page showed only those "most recent ones" (because I didn't see that those where the most recent ones -- I thought they were all the ones)
tufisi has quit [Ping timeout: 244 seconds]
tufisi has joined #ocaml
tufisi has quit [Ping timeout: 245 seconds]
struktured has joined #ocaml
eikke has quit [Ping timeout: 244 seconds]
Anarchos has quit [Quit: Vision[0.9.7-H-090423]: i've been blurred!]
ulfdoz_ has joined #ocaml
ulfdoz has quit [Ping timeout: 248 seconds]
ulfdoz_ is now known as ulfdoz
emmanuelux has quit [Read error: Connection reset by peer]
bokuk has joined #ocaml
bokuk has quit [Client Quit]
bokuk has joined #ocaml
furafollas has joined #ocaml
furafollas has left #ocaml []
adrien has joined #ocaml
bokuk has quit [Quit: 전 이만 갑니다.]
dsheets has joined #ocaml
isson has joined #ocaml
BiDOrD_ has joined #ocaml
BiDOrD has quit [Ping timeout: 265 seconds]
iratsu has quit [Ping timeout: 248 seconds]
Hussaind has joined #ocaml
Hussaind has left #ocaml []
phao has quit [Quit: Not Here]
lamawithonel has joined #ocaml
dwmw2_go` has quit [Read error: No route to host]
phao has joined #ocaml
lamawithonel has quit [Remote host closed the connection]
lamawithonel has joined #ocaml
dwmw2_gone has joined #ocaml
phao has left #ocaml []
hto has quit [Read error: Connection reset by peer]
phao has joined #ocaml
ftrvxmtrx has quit [Ping timeout: 245 seconds]
<phao> the == operator is more like scheme's eq? or eqv? ?
<adrien> the (==) equality is: if mutating one of the argument also mutates the other, then both args are equal
<adrien> i.e. they're using the same memory location
<phao> it looks like eq?
<phao> adrien, the main "problem" is when it comes to literals
<phao> 3 == 3, returns true... I will never change one of these 3 to see if the other changed =)
<phao> x is 3, x == 3 ?
<phao> if yes (for all numbers, chars, ...), then == looks more like eqv? actually
<adrien> yeah, ints are different
<adrien> iirc, basically whatever does not get allocated in a block or something like that
<adrien> there's doc about this too but you have the big picture
* adrien afk for the day
greggies has quit [Ping timeout: 245 seconds]
osa1 has quit [Quit: Konversation terminated!]
bjorkintosh has quit [Read error: Connection reset by peer]
pango is now known as pangoafk
djcoin has joined #ocaml
Sablier has joined #ocaml
thomasga has joined #ocaml
<phao> the keyword fun well describes functions.
<phao> and that was really nerdy
<kaustuv> phao: beware of false intuitions: 1.0 == 1.0 ;;
<phao> yeah
<phao> I should probably use == if I need to check value equality.
silver has joined #ocaml
<flux> I wonder if people new to ocaml should even be taught about == or not. but if they know another language, they probably use == by accident at some point, and may find that their code 'works' and become extra-confused
<mrvn> exactly.
<mrvn> They should be told not to use == and why :)
<phao> in ocaml, using = mostly is not actually a problem
<taruti> isn't (==) just pointer equality and (=) the value equality? why is it so complex?
<phao> in scheme, using equal? is something I really don't like, because a lot of decisions about types are done at run-time
<mrvn> taruti: == is physical equality (yes, the address for pointers). The problem is that people don't always know what is a pointer and what not
<phao> in ocaml, that's not an issue... and using = is fine
<flux> it's not complex, but if you think == works the same as in python or perl, you might first find that indeed it does work that way, except it doesn't.
<flux> for example with strings.
<mrvn> taruti: # 1.0 == 1.0;;
<mrvn> - : bool = false
<mrvn> # 1 == 1;;
<mrvn> - : bool = true
<flux> also I think pointer equality is quite rarely used thing anyway.
<phao> == doesn't seem to be pointer equality
<phao> x = 3, x == 3 is true
<mrvn> You need it for functions and circular structures
<taruti> yes, could use a longer name.
<phao> I double 3 even has an address.
<mrvn> phao: integers are stored as tagged values, not as pointers
<phao> =)
<flux> well, it works as = for values that are untagged
<phao> I like to think of ==, and eq? as a pointer equality for functions and variables
<phao> but I just don't use them for literals
<phao> doesn't make sense, and it's too confusing, for me.
<mrvn> == depends on the implementation of the memory layout in the GC.
beckerb has joined #ocaml
<phao> see, too confusing =D
<flux> maybe it would be fair for == to throw an exception for untagged values, like = throws for functional etc values :)
<mrvn> it would help to have a == | = operator that doesn't throw an exception for functions or goes into enless loops with identical caclic structures
<mrvn> gotta catch a train, *wave* back soon
<kaustuv> Unless you understand OCaml's object model, just don't use ==. You don't understand it.
<kaustuv> PS, for fun and laughs, try: Obj.magic [] == Obj.magic None ;;
ankit9 has joined #ocaml
ftrvxmtrx has joined #ocaml
eni has joined #ocaml
<flux> that works with plain = as well
<kaustuv> I think the documentation for (==) is seriously misleading. It says that for e1 and e2 of a boxed type, e1 == e2 *iff* mutating also "affects" e2, but this is bogus. http://paste.debian.net/172761/
<kaustuv> clearly it is necessary but *not* sufficient that mutating one affects the other
<Ptival> "On mutable types such as references, arrays, strings, records with mutable fields and objects with mutable instance variables"
eikke has joined #ocaml
<Ptival> let's argue :)
<kaustuv> What is there to argue? You can trivially modify my example to use a record with a mutable field instead of a pair. Anyhow the documentation specifies a runtime behaviour for (==), and there is no difference between a pair and a record with two mutable fields at runtime.
Cyanure has joined #ocaml
<mrvn> kaustuv: you aren't modifying e1/e2, you are modifying (snd e1).m
<Drakken> Where is that misleading claim about (==)?
<kaustuv> I was paraphrasing. Read the actual text if you want to quibble
<kaustuv> I guess it does depend on what "physical modification" means. I interpret it to mean mutation, but I suppose it is possible to imagine that it means something else
<Drakken> The statement only applies to mutable types. Tuples aren't mutable.
<kaustuv> bah!
avsm has joined #ocaml
<Drakken> booyah!
isson has left #ocaml []
emmanuelux has joined #ocaml
thomasga has quit [Quit: Leaving.]
Cyanure has quit [Remote host closed the connection]
mfp has quit [Ping timeout: 265 seconds]
<phao> nice docs
cago has joined #ocaml
mfp has joined #ocaml
ankit9 has quit [Ping timeout: 260 seconds]
ankit9 has joined #ocaml
eni has quit [Quit: Leaving]
ankit9 has quit [Quit: Leaving]
Tobu has quit [Ping timeout: 272 seconds]
_andre has joined #ocaml
Tobu has joined #ocaml
<Drakken> Failure: lexing: empty token.
<Drakken> ocamlbuild said that right after I added a _tags file.
<Drakken> but there's nothing in _tags about that target.
Yoric has joined #ocaml
<Drakken> The error goes away when I remove _tags.
tmaedaZ has quit [Ping timeout: 240 seconds]
<Qrntz> Drakken, could you pastebin your _tags?
tmaedaZ has joined #ocaml
<Drakken> Qrntz there's only one entry:
<Drakken> MetlString.ml: pp(camlp4rf)
<Drakken> And I get the error when building Metl.cmo
<Drakken> MetlString depends on Metl
<Drakken> There's also Metl.mlpack, Metl/ and Metl/_tags
silver has quit [Read error: Connection reset by peer]
avsm has quit [Quit: Leaving.]
osa1 has joined #ocaml
cdidd has joined #ocaml
silver has joined #ocaml
<Drakken> Does ocambuild ignore Foo/_tags if ./_tags exists and I'm building Foo.cmo?
<Drakken> even if the source files are in Foo/ ?
cdidd has quit [Read error: Connection reset by peer]
cdidd has joined #ocaml
Tobu has quit [Ping timeout: 272 seconds]
<Drakken> Oh. I forgot the angle brackets.
Tobu has joined #ocaml
avsm has joined #ocaml
cago has quit [Quit: Leaving.]
bjorkintosh has joined #ocaml
rgrinberg has quit [Ping timeout: 265 seconds]
<ssbr_> How should I find out how camlp4 lexes a string?
<ssbr_> I'm trying to debug a parsing failure
<kaustuv> calling camlp4of (and friends) should print out the modified ast by default
<ssbr_> this isn't ocaml code, it's prolog code that uses the default lexer
companion_cube has joined #ocaml
<ssbr_> eh, it's prolog code, and the parser uses the default lexer*
<kaustuv> Hmm... maybe use #syntax on the toplevel and cut-and-paste code?
<kaustuv> err, #camlp4o, not #syntax
<kaustuv> (that's part of ocamlfind...)
<kaustuv> actually, I have no idea what I'm talking about. Never mind.
<ssbr_> camlp4o, huh?
<ssbr_> ok. :(
<ssbr_> I just want to see the token stream
<kaustuv> I misunderstood your question, sorry
rgrinberg has joined #ocaml
<ssbr_> ugh I have no idea how else to debug this
<ssbr_> I add some syntax and things magically blow up? I guess it gets parsed by the wrong thing? But why?
<ssbr_> and how am I supposed to know how it parses things, since it doesn't/can't prettyprint parse results?
<Drakken> What's the error message?
thomasga has joined #ocaml
<Drakken> How do you make sure Bar gets included in Foo when you're loading Foo with Dynlink?
<Drakken> I tried including Bar in Foo.Bar, but that didn't work.
greggies has joined #ocaml
<Drakken> Or more simply, how do you compile one module into the .cmo file of another module?
<Drakken> It looks like Dynlink can't make modules available to each other.
<kaustuv> ssbr_: I presume you have tried the idea here? http://brion.inria.fr/gallium/index.php/Full_parser_tutorial
<kaustuv> you might have to write your own printer for the Prolog ast through
<ssbr_> Drakken: the error message is unrelated
<ssbr_> Fatal error: exception Failure("Relation `b' not found in interpreter state!")
<ssbr_> basically, this signals to me that it was a successful, incorrect, parse
<ssbr_> kaustuv: that's basically what I'm doing...
<ssbr_> I think. I'm currently just an editor of code, not a person that actually understands how/why it works. :<
avsm has quit [Ping timeout: 256 seconds]
<Drakken> ssbr_ have you tried running camlp4 on the command line and looking at the output code?
<ssbr_> Drakken: that works on non-ocaml code?
<ssbr_> how do I tell it to use my parser?
<Drakken> the pp option takes a command-line parser even with ocamlc. what is that parser command?
<ssbr_> Parser command?
<ssbr_> Uhhh, I don't actually know what we're talking about.
<ssbr_> I have a .p4 file that defines a new grammar, and it parses incorrectly probably because I misunderstand the tokenizer
<Drakken> how do you build your code?
<ssbr_> Build which code? The parser is a .p4 file
<Drakken> it's a standalone executable?
<Drakken> camlp4 usually takes .cmo files as grammar extensions.
<ssbr_> Drakken: this is not a grammar extension
<ssbr_> it is an entirely new grammar.
<ssbr_> it extends the empty grammar.
<Drakken> how do you feed your prolog code to the parser?
<ssbr_> Drakken: Gram.parse_string
<Hodapp> do folks write parsers in OCaml often?
<ssbr_> the parse function is: let parse string = try Gram.parse_string program (Loc.mk "<string>") string with exn -> ...
<ssbr_> "program" is a rule in the grammar
<ssbr_> uhhhh
<Drakken> ssbr_ I mean externally. Which executable is calling parse_string?
<ssbr_> sorry, program is Gram.Entry.mk "program"
ftrvxmtrx has quit [Read error: Connection timed out]
<ssbr_> Drakken: you want the name of the executable? "datalog"
ftrvxmtrx has joined #ocaml
<Drakken> Is datalog also the compiler, or is it only a preprocessor?
<ssbr_> Drakken: datalog runs the parser, compiler, and interpreter
<ssbr_> in one executable
<ssbr_> If possible I'd really just like to run the ocaml lexer and see what it outputs :S
<ssbr_> I am not confident I know the lexer well enough to write a parser
<ssbr_> so I want to check things
<Drakken> Well, PreCast/Lexer.mk creates the lexer.
<ssbr_> I don't have the camlp4 source code
<ssbr_> I thought Plexer.gmake was what created the lexer?
<ssbr_> I just can't find any documentation
cdidd has quit [Ping timeout: 245 seconds]
cdidd has joined #ocaml
<Drakken> I think Plexer is obsolete. Now the standard parser is PreCast.
<Drakken> Gram usually refers to Camlp4.PreCast.Gram
<ssbr_> OK, am I looking at bad docs?
<Drakken> Yes, that's badly out of date.
<ssbr_> Drakken: where are the official docs?
<Drakken> There doesn't seem to be any. I've been using the source.
<ssbr_> ...
bjorkintosh has quit [Ping timeout: 252 seconds]
<Drakken> ssbr_ maybe Gram.lex_string loc str
osa1 has quit [Ping timeout: 245 seconds]
<ssbr_> Hummm, how would I pretty-print the results of that?
<ssbr_> It's of type string ->
<ssbr_> (Camlp4.PreCast.Gram.Token.t * Camlp4.PreCast.Gram.Loc.t) Stream.t
<ssbr_> Camlp4.PreCast.Gram.not_filtered
phao has left #ocaml []
<Drakken> I'm not sure. In the toplevel, maybe you can convert the stream to a list?
cdidd has quit [Quit: Leaving]
<Drakken> The only thing I know about printing camlp4 data is that you can print a grammar like this:
<Drakken> Camlp4.PreCast.Gram.Entry.print Format.std_formatter Camlp4.PreCast.Syntax.expr
cdidd has joined #ocaml
<ssbr_> at times like these I wish ocaml had an (ad-hoc) polymorphic print function :/
<mrvn> or at least a mono-polymorphic one. As in it will pretty print if the type is known at compile time
bjorkintosh has joined #ocaml
ftrvxmtrx has quit [Quit: Leaving]
<Drakken> You might try Token.print and Token.to_string.
<Drakken> value print ppf x = pp_print_string ppf (to_string x)
osa1 has joined #ocaml
cdidd has quit [Quit: Leaving]
<ssbr_> man the docs are awful
bjorkintosh has quit [Ping timeout: 260 seconds]
Yoric has quit [Remote host closed the connection]
Cyanure has joined #ocaml
<ssbr_> Drakken: nah, that's for
Yoric has joined #ocaml
<ssbr_> Camlp4.PreCast.Gram.Token.t (sorry, accidentally hit enter)
<ssbr_> as opposed to (Camlp4.PreCast.Gram.Token.t * Camlp4.PreCast.Gram.Loc.t) Stream.t Camlp4.PreCast.Gram.not_filtered
<ssbr_> which I have no idea how to handle
<ssbr_> I mean I could fetch the tokens, but how do I unpack Camlp4.PreCast.Gram.not_filtered ? pattern matching? Does that work?
* ssbr_ is not very good at ocaml
cdidd has joined #ocaml
<ssbr_> Oh, right, yes, it's a type defined as type 'a not_filtered = ...
* ssbr_ sighs
eikke has quit [Ping timeout: 260 seconds]
eikke has joined #ocaml
<Drakken> Well, there's a Gram.filter function, but you'll have to deal with the stream and whatever other details there are.
<ssbr_> I have no idea what filter does
<ssbr_> I did notice it, but like, is its jub just to get rid of the type? Why?
<ssbr_> and yeah, the stream that I didn't notice because I'm blind
<Drakken> It removes whitespace
<Drakken> and maybe comments and other junk
<ssbr_> yay an infinite loop of printing "EOI"
<ssbr_> (or IEO, or OIE)
<ssbr_> I can figure it out for now
bjorkintosh has joined #ocaml
<Drakken> type not_filtered 'a = 'a;
Tobu has quit [Ping timeout: 248 seconds]
<Drakken> so you can just write filter (x: 'a not_filtered) : 'a = x
<Drakken> and then match the elements of the stream with (tok,_)
<Drakken> and then write a pretty-print function :D
<ssbr_> woo I got the lexer to output stuff
<ssbr_> Drakken: thanks for your help
<ssbr_> it's my first time writing imperative code in ocaml. Actually it worked out fine: http://bpaste.net/show/2moOWjKCfvcxga7sIfx4/
<ssbr_> and, there we go!
<ssbr_> my problem was that I was doing LIDENT instead of UIDENT because I forgot what LIDENT means. :|
beckerb has quit [Quit: Konversation terminated!]
<ssbr_> Yup, that was it.
<Drakken> rockin'! :)
<ssbr_> I am so glad I have a lexer printer thinger now. This will help lots. :)
rwmjones has quit [Excess Flood]
rwmjones has joined #ocaml
Sablier has quit [Read error: Connection reset by peer]
Tobu has joined #ocaml
silver has quit [Remote host closed the connection]
othiym23 has quit [Ping timeout: 244 seconds]
gmcabrita has quit [Ping timeout: 244 seconds]
gmcabrita has joined #ocaml
gmcabrita is now known as Guest62475
Guest62475 is now known as gmcabrita
NaCl has quit [Ping timeout: 244 seconds]
NaCl has joined #ocaml
NaCl has quit [Changing host]
NaCl has joined #ocaml
greggies has quit [*.net *.split]
cyphase has quit [*.net *.split]
wtetzner has quit [*.net *.split]
ssbr_ has quit [*.net *.split]
alxbl has quit [*.net *.split]
tomprince has quit [*.net *.split]
Sablier has joined #ocaml
rixed has quit [Ping timeout: 244 seconds]
rixed has joined #ocaml
thomasga has quit [Ping timeout: 244 seconds]
djcoin has quit [Quit: WeeChat 0.3.2]
greggies has joined #ocaml
cyphase has joined #ocaml
wtetzner has joined #ocaml
ssbr_ has joined #ocaml
alxbl has joined #ocaml
tomprince has joined #ocaml
eni has joined #ocaml
bjorkintosh has quit [Ping timeout: 256 seconds]
Snark has joined #ocaml
<taruti> Is there any good way to interface with C++ libraries?
seanmcl has joined #ocaml
<thelema_> taruti: via c wrappers
<thelema_> not directly
<_habnabit> taruti, same as with C libraries; just make sure to wrap the bits that call the ocaml code with extern C
<_habnabit> oh, is there a problem with doing it directly?
<taruti> thelema_: it is quite a large api, thus would need to write/generate lots of wrappers.
<_habnabit> oh, there's swig for ocaml
<thelema_> _habnabit: object method calls
<_habnabit> thelema_, I don't know how you do that in C
<taruti> swig was painfull at least some years back
<taruti> (e.g. custom operator new etc)
<_habnabit> taruti, er, did you mean C++ objects or ocaml objects?
<taruti> _habnabit: C++ library with custom allocators, templates, exceptions and other nasty critters.
eni has quit [Ping timeout: 252 seconds]
<taruti> I suppose I can look into how swig works these days
<_habnabit> oh, sorry, mistell
<_habnabit> the, er, did you mean C++ objects or ocaml objects?
<_habnabit> thelema_ ^
<thelema_> Haseo: c++ objects
<thelema_> _habnabit: c++ objects
othiym23 has joined #ocaml
<adrien> avoid swig
Tobu has quit [Ping timeout: 272 seconds]
Tobu has joined #ocaml
zorun has quit [Ping timeout: 252 seconds]
zorun has joined #ocaml
<mrvn> _habnabit: For doing it directly you would have to reimplement the c++ name mangling in ocaml and you would still need c++ wrappers to translate the ocaml values to c++ values and back.
<mrvn> _habnabit: easier to use extern "C" and let gcc handle the name mangling for you.
<_habnabit> mrvn, yeah, I mentioned extern C
<mrvn> taruti: ^^^
zorun has quit [Ping timeout: 250 seconds]
<mrvn> sorry, ENICK
zorun has joined #ocaml
avsm has joined #ocaml
mgodshall has quit [Quit: leaving]
zorun has quit [Ping timeout: 244 seconds]
zorun has joined #ocaml
zorun__ has joined #ocaml
zorun has quit [Ping timeout: 240 seconds]
zorun__ has quit [Read error: Connection reset by peer]
greggies has quit [Ping timeout: 245 seconds]
zorun has joined #ocaml
mgodshall has joined #ocaml
osa1 has quit [Quit: Konversation terminated!]
osa1 has joined #ocaml
pangoafk is now known as pango
wmeyer has joined #ocaml
<wmeyer> hi
<adrien> morning :p
<mrvn> evening
<wmeyer> mrvn: adrien afternoon
fraggle_ has quit [Read error: Connection reset by peer]
<wmeyer> I think Camlp4FoldGenerator is wonderful
<wmeyer> there would be more work to support other visitors though
dsheets has quit [Ping timeout: 244 seconds]
<wmeyer> in particular FoldMap style with full full descent control
<wmeyer> I just tried and I love SYB idea done in OCaml
flux has quit [Ping timeout: 245 seconds]
greggies has joined #ocaml
dsheets has joined #ocaml
tufisi has joined #ocaml
avsm has quit [Quit: Leaving.]
andreypopp has joined #ocaml
fraggle_ has joined #ocaml
seanmcl has quit [Quit: seanmcl]
emmanuelux has quit [Remote host closed the connection]
emmanuelux has joined #ocaml
seanmcl has joined #ocaml
itewsh has joined #ocaml
Tobu has quit [Ping timeout: 272 seconds]
Tobu has joined #ocaml
ftrvxmtrx has joined #ocaml
SanderM has joined #ocaml
Snark has quit [Quit: Quitte]
rwmjones has quit [Ping timeout: 250 seconds]
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
thomasga has joined #ocaml
thomasga has quit [Client Quit]
_andre has quit [Quit: leaving]
andreypopp has quit [Quit: Quit]
smondet has joined #ocaml
avsm has joined #ocaml
Yoric has quit [Ping timeout: 264 seconds]
osa1 has quit [Quit: Konversation terminated!]
Cyanure has quit [Read error: Connection reset by peer]
wmeyer has left #ocaml []
wmeyer has joined #ocaml
<wmeyer> if that Camlp4FoldGenerator was slightly more flexible
seanmcl has quit [Quit: seanmcl]
eni has joined #ocaml
rwmjones has joined #ocaml
<pippijn> I like how type inference enables the existence of camlp4
<Hodapp> pippijn: Out of curiosity, what is it about type-inference that enables its existence
<Hodapp> ...?
<pippijn> without type inference, you would need to make a lot more effort and maybe even perform a full type check
<Hodapp> That sounds more like making it easier than enabling its existence
<pippijn> sure
<pippijn> but the harder something becomes, the less likely it exists
<adrien> hmmm
<adrien> that's not how a man's brain works ;p
<pippijn> it is
<pippijn> why are there no proper refactoring tools for C++?
<pippijn> why are there a shitload of them for java?
<adrien> oh, they exist
<pippijn> because java is a super easy language to parse
<taruti> java code is so bad it needs constant refactoring? :P
<adrien> they don't necessarily work well however :P
<Hodapp> because... C++.
<pippijn> my point has been made
<taruti> and no-one wants to rewrite C++.
<Hodapp> Java can be parsed with LALR, C++.......... has a formally undecidable grammar.
<taruti> C++ feels larger than CL and that is a lot
<Hodapp> it's a monstrosity.
<Hodapp> and people use it to build even uglier monstrosities.
<Hodapp> and then they convince themselves that the fact that they just built a monstrosity must mean that they're good at coding.
<pippijn> I used to
Tobu has quit [Ping timeout: 272 seconds]
Tobu has joined #ocaml
<wmeyer> pippijn: C++ is a badly designed languagage - it promotes code abuse more then any other language. Supports mulitple paradigms but each one in a broken way. Refactoring C++ and completion is hard because of existance of templates - that are turing complete - and not only needs interpreter to unroll, but can't be analysed without compiler support.
<wmeyer> Apart from that it has regulard #defines
<wmeyer> all this stuff just makes crazy to support in tooling
<wmeyer> not mentioning broken ABI
<pippijn> wmeyer: proper java refactoring also needs compiler support
<wmeyer> which is basically C ABI with mangling and additional tweaks to support multiple symbols generated by the templates
<pippijn> wmeyer: the difference is that a complete java parser and type checker can be done within a day
<wmeyer> pippijn: Sure, but with C++ is way harder. Java hasn't got preprocesor and template, which support weird way of metaprogramming
<pippijn> and the same for C++ takes weeks if not months
sivoais has quit [Ping timeout: 250 seconds]
<wmeyer> pippijn: I agree with that
<wmeyer> pippijn: the other problem is not well formed standard, had occasion to deal with that huge book where there are some places that the creators dont comprehend
itewsh has quit [Quit: o/]
<wmeyer> it has lot of ifs & butts that the tools need to support (including compilers)
<wmeyer> sometimes combination of these just breaks things
<pippijn> yes, C++ is not fun
cdidd has quit [Ping timeout: 252 seconds]
<wmeyer> pippijn: i am so happy it
<wmeyer> it
<pippijn> ?
<wmeyer> it's #ocaml not #c++
<pippijn> ah
<pippijn> yeah
<wmeyer> sorry my laptop keyboard is broken
<pippijn> I'm in ##c++ actually ;)
<wmeyer> damn! ;)
<wmeyer> pippijn: what r u doin' there
<pippijn> I used to write a lot of C++
<wmeyer> me too
<pippijn> I still do, occasionally
<pippijn> but in the Qt framework
<wmeyer> me too unfortunately
<pippijn> which is a lot less absurd than what I used to do
<wmeyer> MFC?
<wmeyer> ;)
<pippijn> no, my own stuff with heavy template magic
<jonafan> i used MFC
<pippijn> I'm one of those guys who understand most of boost
<jonafan> not cool
sivoais has joined #ocaml
<pippijn> I'm happy to not know anything about MFC except that it has a CString
<wmeyer> templates are quite cool - i wasn't heavy boost user - but i did have STL programs - including adapters, functors etc.
<wmeyer> s/have/heavy/
<pippijn> they are
<pippijn> you can build really pretty client code with it
<wmeyer> jonafan: MFC is bad! :-)
<wmeyer> jonafan: wtl is maybe better
<jonafan> i never used wtl
<pippijn> but the things you have to do before you get your pretty client code are.. not pretty
<jonafan> MFC did suck though
<wmeyer> pippijn: I agree, the interface might look good, but when I see this spaghetting in the implementation..
<pippijn> yep
<wmeyer> they are quite powerful abstractions - i think they provide sort of type inference (throgh function templates) and type classes or modules (through template specialisaion)
<wmeyer> but how they do is broken and was not designed for it
<pippijn> that's the big problem
eikke has quit [Ping timeout: 265 seconds]
<pippijn> and the awesomeness
<pippijn> C++ can be used to build a lot of things that can be found in other languages
<pippijn> with enough trickery, you can build almost anything
<adrien> s/C++/asm/
<wmeyer> pippijn: still compile needs to compile that without bugz ;-)
<adrien> and you don't even need trickery
<wmeyer> s/compile/compiler/
<pippijn> wmeyer: yeah
<pippijn> I remember something really weird I had to do to work around a gcc bug
<pippijn> no, I don't remember
<pippijn> let me see if it's still there
<wmeyer> If I can wave my hand - templates are *good* but objects in C++ are *broken*, one of the things are just good and not broken that is
<wmeyer> pippijn: i have a pleasure to work on proprierity C++ compiler ;-)
<pippijn> ok, it's not there anymore
<wmeyer> pippijn: perhaps there are another two lurking
<wmeyer> and another one in the standard
<pippijn> I had to add "int dummy = 0;" to a function body in some template so gcc wouldn't crash
<wmeyer> :D
<wmeyer> yes, that's quite normal - add static and volatile and see what will happen
<wmeyer> + 5 deep hierarchy of classes with multiple inheritance and lot of diamonds in it
<pippijn> diamonds are forever
<wmeyer> in fact this is cite of what one of the bug reports
<wmeyer> and complaining that sometimes is badly compiled
<wmeyer> pippijn: :D
<wmeyer> pippijn: yes c++ is no fun
<wmeyer> pippijn: no fun anymore
<pippijn> right
<wmeyer> and your colegues will not appreciate you on getting wild with templates
<pippijn> very true
<wmeyer> they will abuse allocators instead
<pippijn> battling each other with crazy C++ abuses
<wmeyer> one of the things that is present in every old C++ codebase, is custom memory managment
<pippijn> yes
<wmeyer> people just love to cast to void* and provide nice replacements for new
<wmeyer> not mentioning custom allocators for STL
<pippijn> I made one, using g_slice allocator
<pippijn> from glib
<pippijn> and it made sense, and it still does
<wmeyer> pippijn: yes, i notice that C++ programmer wakes up with one eager in the morning, depending on the mood, she has a great choice of "abstractions" to abuse - ranging from c preprocessor, through template meta programming, reinterpret_casts, to objects and RTTI, and null pointers
<wmeyer> pippijn: never done custom allocator - apart from the custom new operator for debugging
<pippijn> STL allocators are not fun
<pippijn> 95% boilerplate
<wmeyer> pippijn: and i think not easy to get right
<pippijn> indeed
<wmeyer> I would like to see Camlp4MapFoldGenerator
<pippijn> map, fold, iter
<wmeyer> yes, but the idea is that it scraps a lot of bolierplate
<pippijn> yes, like this: http://paste.xinu.at/mZjNT/
<wmeyer> :(
<wmeyer> that's what i try to avoid these days
<pippijn> it's theoretically easy to make mistakes in handwriting that
<wmeyer> if the AST is simple is easy - but this AST is already complicated - and lot of code is just boiler plate
<pippijn> I was lucky and made no mistakes
<wmeyer> pippijn: no, it;s fine, i do the same thing too - but today i looked what camlp4 can offer me
<pippijn> it's a C AST, by the way
seanmcl has joined #ocaml
<wmeyer> pippijn: is easy to make a mistake, forgot to descent for instance
<pippijn> yes
<wmeyer> or add variables to the environment
<wmeyer> interesting
<wmeyer> are you doing C quotes in Camlp4
<pippijn> map and iter can be expressed in terms of fold, of course, but having them readily available would be nicer
<wmeyer> that would rock
<pippijn> wmeyer: I'm not, but I could.. what would you imagine that to do? FFI?
<wmeyer> pippijn: code generation to C? any code generation - including FFI
<wmeyer> pippijn: let's say you have a PEG parser generator and want to have a nice API to generate this code
<wmeyer> you load the C quote library and here you go
<pippijn> ah that kind of quotes
<pippijn> yeah
<pippijn> but
<pippijn> can I use a menhir parser with camlp4?
<wmeyer> i had a quite few ocassions where i was implementing partial C AST wanting to emit quikcly some code in controlled way (not strings)
<wmeyer> of course you can
<pippijn> well that's great
<wmeyer> it will not be extensible though - but for quotes is perfect
<pippijn> then making C quotes would be easy
<wmeyer> so
<wmeyer> you can use your own lexer of course :-)
<pippijn> an ocamllex one, I hope
<wmeyer> I could possibly add the camlp4 bits & pieces if you need some help
<wmeyer> of course ocamllex is good
<pippijn> I'm busy for the next 2 months
<wmeyer> that's fine at the moment i also have some pending work
<wmeyer> (oasis and other stuffs)
<wmeyer> just shout and we can do something cool
<wmeyer> (i really need these quotes in C and many people too)
<pippijn> sure :) sounds good
Submarine has quit [Quit: Leaving]
<wmeyer> :-)
<wmeyer> question: are you already parsing to this AST C code?
<pippijn> I have a working parser
<wmeyer> it would be cool to experiment with code generation then :-)
<pippijn> you can try it here
<pippijn> wait..
<wmeyer> cool!
<wmeyer> i know about cil and cfront
<wmeyer> wow
<wmeyer> that's pretty cool
<wmeyer> is it js_of_ocaml?
<pippijn> yes
<wmeyer> these unit placholders are locations and type information?
<pippijn> yep
<wmeyer> nice :-)
<pippijn> I have a partial implementation of a type check
<pippijn> but I had to stop due to a lack of time
<pippijn> | TypedExpression of (*ty*)ctype * (*value*)Constant.t * (*expr*)expression
<wmeyer> is you had more man power do you consider to also support C++? Just curious
<pippijn> I really want to write | TypedExpression of { ty : ctype; value : ...
<pippijn> wmeyer: I already considered it
<pippijn> and I already have a working C++ parser in ocaml
<wmeyer> pippijn: the reason for this question is - c++ is crap but we need to support it
<pippijn> but not the least bit of type check and AST
<pippijn> just a parser that returns unit
<pippijn> or a parse tree
<pippijn> made of strings and lists
<wmeyer> pippijn: there is a feature description in mantis about it
<wmeyer> inline records
<pippijn> yeah, I know
<pippijn> I'm waiting for it to happen
<pippijn> then I will immediately change my AST to use them
<wmeyer> keep nagging on mailing list - it might help
<pippijn> or not, because I will work on the C++ parser instead
<pippijn> I don't know yet
<pippijn> C++ is such a beast
<wmeyer> i think Alain is quite keen - and knowing him eventually will get that to trunk
tomprince has left #ocaml []
<wmeyer> pippijn: any git repository?
<wmeyer> i like the idea
<pippijn> https://github.com/pippijn <- all the pieces are here, but broken apart. I just wanted to upload them so someone who likes it can use it
<wmeyer> it's a good thing to compile c++ because - then your frontend or compiler is "certified" to be able to compile c++ which is sad but true
<wmeyer> sad because c++ is powerful but a bit broken language and supporting is must but difficult
<pippijn> my plan with this C thing was first to create a clean C parser in ocaml
<wmeyer> sad because people think still is the only powerful language s out there..
<pippijn> and also, it was my first ocaml project
<pippijn> my introduction to ocaml
<pippijn> and the further plan was to add features and source to source translation
<pippijn> because it supports almost all GNU extensions and it could translate them to C89
<pippijn> and that would be fun
<wmeyer> pippijn: I am impressed
<pippijn> the grammar is ugly
<pippijn> and attributes are stupid
<wmeyer> and this was what i was thinking about for quite long time - if i could get dragonkit working with the subset of C it would be good, but i am not there yet! but i consider this even now
<wmeyer> of course one way would be to get the llvm IR from clang
<wmeyer> and then compile it why dragonkit
greggies has quit [Quit: Ex-Chat]
<wmeyer> but of course much better way is to use your parser directly :-)
<pippijn> :)
<pippijn> I'll be happy if my first ocaml project is actually getting use
<wmeyer> i am somewhat less lucky ......
<pippijn> wmeyer: note the parse error messages on the parser web interface
<wmeyer> yeah, for sure i started to be obsessed with using you frontend :-)
<pippijn> it's menhir with some awesomesauce
<wmeyer> i looked at the AST identifiers and i quite like them
<wmeyer> it looks clean
chambart has quit [Quit: WeeChat 0.3.2]
<wmeyer> haskelish somewhat
<pippijn> https://github.com/pippijn/menhir <- this menhir
<pippijn> enough bragging
<wmeyer> so you are reparsing this error DSL and match partially parsed AST?
<pippijn> no
<pippijn> much simpler
<wmeyer> just pretty print with the defaults?
<wmeyer> like first var node is "a" the second "b" etc?
<pippijn> this is the result from processing that file and some menhir outputs: http://paste.xinu.at/rch1g/
<wmeyer> so you keep your branch of Menhir? is that because C/C++ grammar is so ugly?
<pippijn> no, menhir has sucky error messages
<pippijn> "Syntax error" is all the information I can get
<pippijn> unless I put error branches everywhere
<pippijn> which either introduces conflicts or is way too coarse
<wmeyer> OK, i know found the messages they look cool
<pippijn> this way I can gave one error message per token/state pair
<wmeyer> do you recover after parsing?
<pippijn> no
<wmeyer> s/parsing/error/
<pippijn> it's either recovery or good error messages
<pippijn> I can allow for recovery too
<pippijn> but right now I handle errors with exceptions
<wmeyer> ok
<pippijn> error recovery was not my priority
<pippijn> it could be done without much effort
<pippijn> and it could be pretty awesome, too
<wmeyer> this is the problem, but could be done
<wmeyer> yes
<pippijn> but
<pippijn> you can basically forget menhir and C++
<pippijn> parsing C++ with LALR is possible
<wmeyer> with lexer support i suppose?
<pippijn> no
<pippijn> after the parse, you need to do some fixups of misparses
<pippijn> some of them using type information
<pippijn> but it's not pretty
<pippijn> and I want pretty
eni has quit [Ping timeout: 260 seconds]
<wmeyer> Of course, the prettines is a major factor that contributes to good quality :) looks good. you could have two ASTs
smondet has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
<wmeyer> pippijn: I like that you have not invented another recursive descent parsing in spaghettin like code
<wmeyer> the thing which is also letting me down in such projects like llvm and clang (apart from other reasons) is that everything is parsed by hand - for unknown reasons to me
<pippijn> error messages
<pippijn> which is why I modified menhir to produce proper ones
manu3000 has quit [Remote host closed the connection]
<wmeyer> pippijn: I am cloning your cparser :-)
<wmeyer> i will try to do the camlp4 part for time being
<wmeyer> pippijn: do you commit there your stuff?
<pippijn> no
<pippijn> wait
<wmeyer> ok
ski has quit [Ping timeout: 265 seconds]
<wmeyer> pippijn: but it's worth to know about this good stuf
<pippijn> you might get luckier with this one
<pippijn> it's where I did my last developments
ftrvxmtrx has quit [Ping timeout: 265 seconds]
<wmeyer> thanks got it!
<pippijn> probably the easiest one to start from
ski has joined #ocaml
ftrvxmtrx has joined #ocaml
<pippijn> I have some unicode crap in there, too
<pippijn> because I can't use batteries in js_of_ocaml
SanderM has quit [Remote host closed the connection]
<wmeyer> seems like my installation of GODI on the laptop is broken
<wmeyer> had anybody got that message:
<wmeyer> "Tried to install several versions of this package at once: godi-ocaml-src"
flux has joined #ocaml
<wmeyer> hello flux
<flux> well hello
<wmeyer> and everything works like before just i am not able to install any package
sgnb has quit [Ping timeout: 252 seconds]
<wmeyer> I need to install these dependencies
seanmcl has quit [Quit: seanmcl]
<wmeyer> hmm
tufisi has quit [Ping timeout: 252 seconds]
Psyclonic has quit [Ping timeout: 240 seconds]
<wmeyer> anybody alive
<wmeyer> i seem to install the core-suite just to get the dependencies (sexplib and type-conv) - neither godi nor odb could work today for me
<wmeyer> and it's not obvious where to get these packages
Tobu has quit [Ping timeout: 272 seconds]