flux changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | Grab OCaml 3.10.2 from http://caml.inria.fr/ocaml/release.html (featuring new camlp4 and more!)
seafood has joined #ocaml
Axioplase has quit ["Lost terminal"]
<seafood> Hey guys, I'm trying to learn about camlp4
<seafood> But it's changed a lot in 3.10 and the documentation at http://brion.inria.fr/gallium/index.php/Using_Camlp4 isn't that great.
<seafood> Can I learn enough from the old reference manual and tutorial? http://caml.inria.fr/pub/old_caml_site/camlp4/tutorial/
<seafood> Do you think that's a good path to take?
<hcarty> seafood: bluestorm, Yoric[DT] and rwmjones are probably good people to ask when they are around
<seafood> Cool. I hope the come on later today. If you see this guys please let me know what I should do ;-)
<hcarty> They have each done fairly significant work with the new camlp4 and are on here often
<seafood> Thanks hcarty.
<hcarty> seafood: Sorry I can't be more help :-) My camlp4 knowledge is limited to hacking at work others have done
nuncanada has joined #ocaml
coucou747 has quit ["bye ca veut dire tchao en anglais"]
nuncanada has quit [Client Quit]
seafood has quit [Read error: 104 (Connection reset by peer)]
seafood has joined #ocaml
Philonous1 has joined #ocaml
Philonous has quit [Connection timed out]
Mr_Awesome has quit [Remote closed the connection]
Mr_Awesome has joined #ocaml
mwhitney has joined #ocaml
bluestorm has joined #ocaml
mwhitney has quit ["WeeChat 0.2.6"]
mwhitney has joined #ocaml
filp has joined #ocaml
filp has quit [Client Quit]
bluestorm has quit [Remote closed the connection]
Asmadeus has joined #ocaml
Asmadeus has quit [Client Quit]
Asmadeus has joined #ocaml
vixey has quit ["Leaving"]
bluestorm has joined #ocaml
hnr has quit [clarke.freenode.net irc.freenode.net]
Associat0r has quit [clarke.freenode.net irc.freenode.net]
bohanlon has quit [clarke.freenode.net irc.freenode.net]
sbok has quit [clarke.freenode.net irc.freenode.net]
shortc|desk has quit [clarke.freenode.net irc.freenode.net]
hnr has joined #ocaml
Associat0r has joined #ocaml
bohanlon has joined #ocaml
sbok has joined #ocaml
shortc|desk has joined #ocaml
bluestorm has quit [Remote closed the connection]
bluestorm has joined #ocaml
bluestorm has quit [Client Quit]
asmanur has joined #ocaml
Snark has joined #ocaml
rwmjones has joined #ocaml
besiria has joined #ocaml
comglz has joined #ocaml
bluestorm has joined #ocaml
rwmjones has quit ["Closed connection"]
asmanur_ has joined #ocaml
asmanur has quit [Read error: 60 (Operation timed out)]
seafood_ has joined #ocaml
seafood has quit [Read error: 104 (Connection reset by peer)]
asmanur has joined #ocaml
Yoric[DT] has joined #ocaml
asmanur_ has quit [Read error: 110 (Connection timed out)]
code17 has joined #ocaml
comglz has quit ["AddToFunc ExitFunction I Exec exec sudo halt"]
comglz has joined #ocaml
asmanur is now known as asma
_numbers_ has joined #ocaml
Philonous1 has quit [Client Quit]
Philonous has joined #ocaml
comglz_ has joined #ocaml
comglz has quit [Read error: 110 (Connection timed out)]
coucou747 has joined #ocaml
code17 has quit [Remote closed the connection]
code17 has joined #ocaml
Ched- has joined #ocaml
Ched- has left #ocaml []
Linktim has joined #ocaml
marmotine has joined #ocaml
seafood_ has quit []
Associat0r has quit []
rwmjones has joined #ocaml
Linktim has quit ["Quitte"]
Linktim has joined #ocaml
pango_ has quit [Remote closed the connection]
pango_ has joined #ocaml
Darek_21 has joined #ocaml
Darek_21 has left #ocaml []
<hcarty> bluestorm: Is this the correct way to match record fields in camlp4? -- http://ocaml.pastebin.com/m77a04b98
<hcarty> This is in the context of numeric.ml in pa-do
<hcarty> The point is to allow Complex.(x.re) to act as x.Complex.re, without using pa_openin-like functionality which could potentially slow things down in some cases
comglz_ has quit [Client Quit]
pango_ has quit ["I shouldn't really be here - dircproxy 1.0.5"]
pango_ has joined #ocaml
Linktim_ has joined #ocaml
<bluestorm> slow things down ?
<bluestorm> (there is a "handy record notation" syntax extension wich do related and lovely things, you should have a look)
<bluestorm> the code seems correct
<bluestorm> but horribly ad-hoc and inelegant
code17 has quit [Remote closed the connection]
<hcarty> bluestorm: Indeed. pa-do provides functions to do this in a cleaner manner
code17 has joined #ocaml
<hcarty> "slow things down" -- for some (simple?) cases, using "Module.(something)" with openin in an expression is slower than using "something" directly. I'm guessing due to inlining or some kind of optimizations which don't work across module bounds?
<hcarty> I wrote a simple benchmark for to test for this a while ago, I'm not sure if I still have it
<bluestorm> i'd be interested
<bluestorm> btw, i saw in the source that they included (and adapted) pa_openin source directly
<bluestorm> i should suggest the to remove the useless temporary identifier
<hcarty> bluestorm: I'll suggest that
Linktim has quit [Read error: 113 (No route to host)]
marmotine has quit [Read error: 110 (Connection timed out)]
coucou747 has quit [Read error: 110 (Connection timed out)]
coucou747 has joined #ocaml
thelema has joined #ocaml
<hcarty> bluestorm: I can't find the benchmark I used, and an attempt to recreate them gave the opposite result :-)
<hcarty> I'm on a 64bit system now, while I was a on a 32bit system before. I don't know if that makes any difference.
<bluestorm> sounds a bit strange at least :p
<bluestorm> hcarty: without further information, i think the saner idea is to use the open_in trick
<bluestorm> if it really turned into a performance problem, an other possibility would be to replace every qualified name in the AST, effectively having the same effect as openin, but at camlp4 time
<bluestorm> half-baked solution can only lead to inconsistencies (fear, inconsistency and doubt :-')
rwmjones has quit ["Closed connection"]
xavierbot has quit [Remote closed the connection]
xavierbot has joined #ocaml
<bluestorm> (!);;
<xavierbot> - : 'a ref -> 'a = <fun>
<coucou747> Oo
<bluestorm> the real deal.
<coucou747> xavierbot> let rec bluestorm = " bluestorm ":: bluestorm;;
<xavierbot> Characters 49-58:
<xavierbot> xavierbot> let rec bluestorm = " bluestorm ":: bluestorm;;
<xavierbot> ^^^^^^^^^
<xavierbot> Parse error: "in" expected after [binding] (in [expr])
<coucou747> Oo
<coucou747> xavierbot> let rec bluestorm = " bluestorm ":: bluestorm in bluestorm ;;
<xavierbot> Characters 1-10:
<xavierbot> xavierbot> let rec bluestorm = " bluestorm ":: bluestorm in bluestorm ;;
<xavierbot> ^^^^^^^^^
<xavierbot> Unbound value xavierbot
<coucou747> shit
<bluestorm> (please limit bot flooding)
<mbishop> let botflood () = print_string "Please limit bot flooding!"; botflood ();;
<xavierbot> Characters 62-70:
<xavierbot> let botflood () = print_string "Please limit bot flooding!"; botflood ();;
<xavierbot> ^^^^^^^^
<xavierbot> Unbound value botflood
<coucou747> why let rec bluestorm = " bluestorm ":: bluestorm;; does not work ?
<mbishop> heh
<bluestorm> let rec bluestorm = " bluestorm ":: bluestorm in bluestorm ;;
<xavierbot> - : string list =
<xavierbot> [" bluestorm "; " bluestorm "; " bluestorm "; " bluestorm ";
<xavierbot> " bluestorm "; " bluestorm "; " bluestorm "; " bluestorm ";
<xavierbot> " bluestorm "; " bluestorm "; " bluestorm "; " bluestorm ";
<xavierbot> " bluestorm "; " bluestorm "; " bluestorm "; " bluestorm ";
<xavierbot> " bluestorm "; " bluestorm "; " bluestorm "; " bluestorm ";
<xavierbot> " bluestorm "; " bluestorm "; " bluestorm "; " bluestorm ";
<bluestorm> hell..
<xavierbot> " bluestorm "; " bluestorm "; " bluestorm "; " bluestorm ";
<xavierbot> " bluestorm "; " bluestorm "; " bluestorm "; " bluestorm ";
<xavierbot> " bluestorm "; " bluestorm "; " bluestorm "; " bluestorm ";
<bluestorm> coucou747: that works
<coucou747> bluestorm> the bot hates me...
<bluestorm> you added stupid stuff
<mbishop> don't need to call his name :)
<bluestorm> don't expect the bot to know that "xavierbot> " is not part of the source code
<bluestorm> because it could be
<coucou747> Oo
<coucou747> ah ok
<bluestorm> now we have an output problem
<coucou747> it was a mass - HL test :)
<bluestorm> hm
<bluestorm> seems the output is actually correct
<flux> 0;;
<xavierbot> - : int = 0
<flux> right, it didn't die on that :)
<bluestorm> the default toplevel print much more terms
<flux> (should've remembered that the toplevel doesn't either)
<mbishop> let x x y z = z x y in let x y = x (x y) in let x y = x (x y) in let x y = x (x y) in let x y = x (x y) in let x y = x (x y) in x;;
<xavierbot> - : 'a ->
<xavierbot> 'b ->
<xavierbot> (('c ->
<xavierbot> (('d ->
<xavierbot> (('e ->
<xavierbot> (('f ->
<xavierbot> (('g ->
<xavierbot> (('h ->
<xavierbot> (('i ->
<xavierbot> (('j ->
<mbishop> :P
<flux> perhaps the limits could be shorter
<bluestorm> or the per-line limit longer
<flux> also a considerable amount of mistakes come from that the bot doesn't require a prefix
<flux> # could be such a prefix, it would then be very similar to the toplevel :)
<bluestorm> iirc there was a prefix before
<flux> I was thinking requiring both prefix and suffix, has that been before?
<mfp> bluestorm, hcarty: let module X = ... causes allocation unless it's a mere module alias
<mfp> hence the possible openin overhead
<mfp> a prefix for xavierbot seems a good idea, there are too many spurious ; ; on #ocaml
<bluestorm> mfp: do you know what is allocated ? (iirc. in the openin case, the content of the module is "include Foo let bar = ...")
bacam has joined #ocaml
<mfp> bluestorm: the module itself, so to speak. It then initializes a slot for the bar function.
<hcarty> bluestorm: Very good point regarding just using openin. If a simple benchmark is giving such strange results, this probably counts as severe premature optimization
mwhitney has quit ["WeeChat 0.2.6"]
<mfp> bluestorm: essentially, it's as if the module were a first class value: it is instantiated at run-time the same way normal modules are in their camlFoo__entry functions, using the heap instead of the data section.
<hcarty> The transformation can be done with pa-do, so if something like that is needed later it can be implemented
<hcarty> mfp: Thank you for the clarification
<hcarty> I may bring up the idea to the pa-do folks just to see what they think
mwhitney has joined #ocaml
<hcarty> bluestorm: Enabling openin (among other options) as a default action with Module.(...) syntax using pa-do is now possible with the latest bzr revision
<hcarty> The pa-do developers are wonderfully responsive
Camarade_Tux_ has joined #ocaml
Camarade_Tux has quit [Read error: 110 (Connection timed out)]
Mr_Awesome has quit ["aunt jemima is the devil!"]
Camarade_Tux_ is now known as Camarade_Tux
coucou747 has quit ["bye ca veut dire tchao en anglais"]
<hcarty> bluestorm: I had reimplemented the benchmark incorrectly. The "slow" version: http://ocaml.pastebin.com/m3905d7cf and the "fast" version: http://ocaml.pastebin.com/m2a0bc94d
<hcarty> For this overly simplified case, the difference on my system is a little less than 50% for native code
<hcarty> As in the slow version takes ~50% longer to run than the fast version
rwmjones has joined #ocaml
<mfp> hcarty: it's irrealistic in that you allocate a closure per iteration
<hcarty> mfp: But that is how opening Foo in Foo.(...) would work
<hcarty> If you use a naive openin-like extension
<mfp> ah, so this is M.(float_of_int i * 2.0)
<hcarty> Yes
<mfp> does pa_do allow M.begin .... end ?
<hcarty> No, apparently not
<hcarty> I just tried it with no luck
<mfp> putting the for loop inside M.() would allow to minimize the module instantiation overhead
<mfp> it seems that enabling "open in" with Foo.(...) is not a good idea in general, though
<mfp> since Float.(....) is going to be one of the principal uses, any slowdown would be bad news
<hcarty> mfp: Yes, pa-do currently supports it on a module-by-module basis by default
<hcarty> Enabling openin as a default action for Foo.(...) only applies for modules with no overloading defined, and even then you have to specify that you want to enable this
<hcarty> Adding OVERLOAD_OPENIN DEFAULT to a source file would enable openin for Foo.(...) but not Float.(...) for example. As I understand it at least.
<mfp> hum the compiler should be smart enough to skip the module allocation + init in this case :-|
asma has quit [Read error: 110 (Connection timed out)]
guillem_ has joined #ocaml
<hcarty> Given that it isn't at this time, camlp4 translations seem like a reasonable fix for now
<hcarty> If the compiler does gain such optimizations then the result of the syntax translation could be simplified accordingly
hkBst has joined #ocaml
besiria has quit [Remote closed the connection]
<Yoric[DT]> Yeah, I've noticed nice speed-ups with Camlp4-based inlinings.
rwmjones has quit ["Closed connection"]
lde has quit [Read error: 113 (No route to host)]
lde has joined #ocaml
lde has quit [Remote closed the connection]
code171 has joined #ocaml
<hcarty> bluestorm: The "handy record notation" extension doesn't do what I want, if it's the extension I think it is
<hcarty> Still likely useful in some cases
<hcarty> But it has a different purpose
<Yoric[DT]> What does it do?
<hcarty> pa_records at http://oandrieu.nerim.net/ocaml/ if that is the correct one
<hcarty> It also seems to be a pre-3.10.0 extension
<hcarty> There is also a patch to allow different records to have fields with the same names
<hcarty> But it is against an old version of OCaml, so I have no idea if it would work against newer OCaml version
<hcarty> s
<hcarty> The patch is on http://alain.frisch.fr/soft.html
<Toonto_del_alma> hcarty, what is the old version?
<hcarty> 3.04 according to the page
code17 has quit [Remote closed the connection]
<flux> that record-patch sure is short
<flux> one could've expected it to be an hairier issue
<hcarty> And the patch applies fairly easily to 3.10.2 as well. I don't know if it /works/, but it applies
Snark has quit ["Ex-Chat"]
asmanur has joined #ocaml
jeddhaberstro has joined #ocaml
lde has joined #ocaml
hkBst has quit ["Konversation terminated!"]
Axioplase_ has quit [Read error: 104 (Connection reset by peer)]
Axioplase_ has joined #ocaml
jlouis has joined #ocaml
code171 has quit ["Leaving."]
asmanur has quit [Read error: 110 (Connection timed out)]
Amorphous has quit [Read error: 110 (Connection timed out)]
Asmadeus has quit ["nighters"]
Amorphous has joined #ocaml
Yoric[DT] has quit ["Ex-Chat"]
Linktim_ has quit ["Quitte"]
guillem_ has quit [Remote closed the connection]
seafood has joined #ocaml
seafood has quit [Client Quit]
seafood has joined #ocaml
seafood has quit [Client Quit]
bluestorm has quit [No route to host]
seafood has joined #ocaml
Associat0r has joined #ocaml
<jeddhaberstro> what's the best way to write an n by n matrix type?
Kopophex has joined #ocaml
<xevz> jeddhaberstro: Array.make_matrix, I suppose. :)
<jeddhaberstro> oh, look at that!