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!)
struktured has quit [Read error: 110 (Connection timed out)]
mike_mcclurg has joined #ocaml
mike_mcclurg has left #ocaml []
mike_mcclurg has joined #ocaml
ppsmimou has quit [Read error: 110 (Connection timed out)]
ozy` has quit [Remote closed the connection]
Kopophex has joined #ocaml
seafood has joined #ocaml
psnively has joined #ocaml
struktured_ is now known as struktured
psnively has quit [Remote closed the connection]
psnively has joined #ocaml
seafood has quit []
Amorphous has quit [Read error: 110 (Connection timed out)]
psnively has quit []
Amorphous has joined #ocaml
seafood has joined #ocaml
Mr_Awesome has quit [Read error: 110 (Connection timed out)]
struktured has quit [Connection timed out]
jeddhaberstro has quit []
jonafan_ has joined #ocaml
seafood has quit []
jonafan has quit [Read error: 110 (Connection timed out)]
Kopophex has quit ["Leaving"]
seafood has joined #ocaml
ozy` has joined #ocaml
ozy` has quit ["Shop for a whopper"]
Mr_Awesome has joined #ocaml
seafood has quit []
ozy` has joined #ocaml
Associat0r has joined #ocaml
seafood has joined #ocaml
seafood has quit [Client Quit]
seafood has joined #ocaml
seafood has quit [Client Quit]
johnnowak has joined #ocaml
seafood has joined #ocaml
seafood has quit []
Yoric[DT] has joined #ocaml
lorph has left #ocaml []
Yoric[DT] has quit ["Ex-Chat"]
<flux> you can do partial application in C with a few macros
<flux> it's the capturing-the-environment that requires a language extension
<Associat0r> that extension is called C++
<ulfdoz> .oO( ... )
seafood has joined #ocaml
mishok13 has joined #ocaml
johnnowak has quit []
Snark has joined #ocaml
<flux> associat0r, I don't think C++ has environment-capturing lambda expressions.. what one can build with boost isn't quite the same.
<Associat0r> flux : have you looked at FC++?
<flux> associat0r, I remember taking a look but I don't really remember anything about it :)
<flux> in any case, what you write as lambda expressions isn't your regular kind of c++ code
<flux> say, you cannot write a for-loop; you may be able to write the equivalent of one, though
<flux> I wonder though if I should start taking advantage of boost or FC++ at work, but the build times are long enough as it is :)
<Associat0r> I have used boost a lot but not much for the FP stuff
<flux> associat0r, so, how's your compiling times?-)
<flux> (hm, s/'s/ are/)
<Associat0r> it was acceptable if you structured the code well
<Associat0r> boost spirit was the heaviest of boost I used
<flux> do you use boost functionality in header files?
<flux> looking at FC++ I must admit it applies some dark magic
<flux> or rather, assume
<Associat0r> some stuff were in headers yes but you should strive to put forward declaration only in headers
<Associat0r> but in many cases you can't avoid that
<Associat0r> I used smart pointers heavily
<Associat0r> naked pointers only in the lowest levels of code
<flux> heh, a type of one short lambda function, which one might even need to write at times: LEType<LAM<LET<BIND<1,int>,BIND<2,int>, CALL<Minus,LV<1>,LV<2> > > > >::Type
<Associat0r> yeah lots of magic
<Associat0r> coincidentally I found out that one of the F# guys is coauthor of FC++
<Associat0r> I kinda agree with him how to structure code http://lorgonblog.spaces.live.com/Blog/cns!701679AD17B6D310!511.entry?wa=wsignin1.0
<Associat0r> flux : I kinda like how you weren't afraid to use objects in goba
<Associat0r> classes I mean
filp has joined #ocaml
<flux> wow, someone took the effort to look at the code :)
<flux> I just took a quick glance myself, and.. my god, it's full of comments! well, atleast object.mli is :)
<Associat0r> flux : are there things you would do differently now?
<flux> I don't know, I haven't given much thought to it
<flux> I don't think I would change the objects to modules, though
<Associat0r> "don't think" or "think"?
<flux> "don't" :)
filp has quit ["Bye"]
Snark has quit ["Ex-Chat"]
seafood has quit []
seafood has joined #ocaml
seafood has quit []
subconscious has quit ["Leaving"]
OChameau has joined #ocaml
ppsmimou has joined #ocaml
rmns has joined #ocaml
ppsmimou has quit [Read error: 104 (Connection reset by peer)]
ppsmimou has joined #ocaml
GustNG has joined #ocaml
<GustNG> Hello I have a problem with camlp4o
<GustNG> It seems pretty simple but I've no idea
<GustNG> I'm compiling haxe and it goes like
<GustNG> Fatal error: the file ast.ml is not a bytecode executable file
<GustNG> Preprocessor error
Yoric[DT] has joined #ocaml
<Yoric[DT]> hi
<gildor> GustNG: commande line just before it fails ?
<GustNG> $ ocamlc -c -I ../ocaml -I ../ocaml/swflib -I ../ocaml/xml-light -I ../ocaml/extc -I ../neko/libs/include/ocaml -pp camlp4o ast.ml lexer.ml type.ml common.ml etc...
<GustNG> Placing the -pp argument elsewhere still complains about Ast
<gildor> GustNG: try to execute this command line directly
<gildor> (i.e. copy and paste it in your shell, without calling the build system
<gildor> )
ppsmimou has quit [Read error: 104 (Connection reset by peer)]
ppsmimou has joined #ocaml
<Yoric[DT]> hi ppsmimou
<gildor> Yoric[DT]: hi
<Yoric[DT]> Well, hi gildor, too :)
<GustNG> I am now, no change
<gildor> GustNG: try this command line: ocamlc -c -I ../ocaml -I ../ocaml/swflib -I ../ocaml/xml-light -I ../ocaml/extc -I ../neko/libs/include/ocaml -pp "camlp4o " ast.ml lexer.ml type.ml common.ml
<GustNG> No change
<Yoric[DT]> What's the problem?
<GustNG> That line complains ast.ml is not a bytecode executable
<GustNG> :c
<gildor> GustNG: ocamlc -c -I ../ocaml -I ../ocaml/swflib -I ../ocaml/xml-light -I ../ocaml/extc -I ../neko/libs/include/ocaml -pp "camlp4o " ast.ml lexer.ml type.ml common.ml
<gildor> sorry
<gildor> GustNG: ocamlc -I ../ocaml -I ../ocaml/swflib -I ../ocaml/xml-light -I ../ocaml/extc -I ../neko/libs/include/ocaml -pp camlp4o -c ast.ml
<gildor> GustNG: try this last command line
<GustNG> Same
<Yoric[DT]> What about putting ast.ml in the beginning?
<GustNG> Then it complains about the next file, including the ones that need the preprocessor.
<gildor> GustNG: what is your version of ocaml/Linux distribution...
<GustNG> 3.10.0, Cygwin
<GustNG> Hm calling it from Windows seems to not die
<gildor> GustNG: it is probably a command line problem
<Yoric[DT]> :/
<gildor> (missing quote in camlp4o or smthg like that)
<Yoric[DT]> Well, time for lunch.
<Yoric[DT]> Good luck.
<GustNG> Yes I'll try to finish it by hand
<gildor> cygwin for buildsys and msvc or pure cygwin
<gildor> GustNG: just have read a mail from rwmjones that remind me that what you are speaking about is maybe a real bug in camlp4
<gildor> GustNG: that should have been fixed in 3.10.2
<GustNG> Alright then it's not Cygwin
<GustNG> I got it to compile
xevz has quit [Read error: 110 (Connection timed out)]
authentic has left #ocaml []
authentic has joined #ocaml
shortc|desk has joined #ocaml
jlouis has quit [Read error: 110 (Connection timed out)]
jlouis has joined #ocaml
seafood has joined #ocaml
seafood has quit [Read error: 104 (Connection reset by peer)]
seafood has joined #ocaml
Axioplase has joined #ocaml
seafood has quit [Read error: 104 (Connection reset by peer)]
seafood has joined #ocaml
seafood has quit [Connection reset by peer]
seafood has joined #ocaml
seafood has quit []
ozzloy has quit [zelazny.freenode.net irc.freenode.net]
ozzloy has joined #ocaml
guillem_ has joined #ocaml
Axioplase has quit ["leaving"]
Asmadeus_ has joined #ocaml
Asmadeus_ has quit [Client Quit]
Asmadeus_ has joined #ocaml
Associat0r has quit []
Asmadeus has quit [Read error: 110 (Connection timed out)]
DroneZilla has joined #ocaml
Asmadeus_ has quit ["Stupidnes Error"]
Asmadeus has joined #ocaml
DroneZilla has left #ocaml []
DroneZilla has joined #ocaml
DroneZilla_ has joined #ocaml
DroneZilla_ has left #ocaml []
mishok13 has quit [Read error: 110 (Connection timed out)]
guillem_ has quit [Read error: 104 (Connection reset by peer)]
rmns has left #ocaml []
DroneZilla has left #ocaml []
tomh_-_ has joined #ocaml
Yoric[DT] has quit ["Ex-Chat"]
Linktim has joined #ocaml
Linktim_ has joined #ocaml
Koordin has joined #ocaml
<Koordin> Hi, i have a problem with ocaml. In string.ml, external unsafe_bilt is called, but i would like to know what this function does. How can i do that ?
<Koordin> Where is it defined ?
_andre has joined #ocaml
Yoric[DT] has joined #ocaml
Proteus has joined #ocaml
Linktim has quit [Read error: 113 (No route to host)]
<Koordin> noone knows ?
<flux> in the sources, obviously :)
<flux> koordin, find string.ml, it says it's an external function
<Yoric[DT]> hi again
<flux> there is says the function is caml_blit_stirng
<flux> the find -name \*.c | xargs grep -l caml_blit_string
<flux> and you will find ./byterun/str.c
<Koordin> ok thanks a lot
<Koordin> what does -name \*.c mean ?
<flux> it's a switch specific to find
<olegfink> find(1) might know the answer
<flux> man find will describe all the available switches
<Koordin> ok
<flux> \* is a quoted *; if it wasn't quoted (as in: *.c), *.c files in the current directory would replace the string, and the find would most likely give wrong or no results
<Koordin> i didn't understand well
<Koordin> find -name \*.c | xargs grep -l caml_blit_string returned no result
<flux> where did you run it?
<olegfink> you probably want to run it in a directory with ocaml sources
<Koordin> oh
<Koordin> jado@Jado:/usr/lib/ocaml/3.10.0$ sudo find / -type d -name byterun
<Koordin> jado@Jado:/usr/lib/ocaml/3.10.0$ sudo find -name \*.c | xargs grep -l caml_blit_string
<Koordin> jado@Jado:/usr/lib/ocaml/3.10.0$
<Koordin> i still have no result
<flux> those are not the sources
<flux> if you haven't compiled ocaml yourself, you will likely not have the sources around
<flux> you can get sources from caml.inria.fr
<olegfink> many linux distributions offer ocaml-sources packages, but still it's better to just get a tarball
<Koordin> i've installed it with apt-get
<flux> right, you're likely running ubuntu, so you can just apt-get source ocaml
<Koordin> ok, thanks, it worked
marmotine has joined #ocaml
Proteus has quit [Read error: 113 (No route to host)]
Proteus has joined #ocaml
subconscious has joined #ocaml
Proteus has quit [Remote closed the connection]
tomh_-_ has quit ["http://www.mibbit.com ajax IRC Client"]
Snark has joined #ocaml
DroneZilla has joined #ocaml
OChameau has quit ["Leaving"]
vpalle has joined #ocaml
rwmjones is now known as rwmjones_afk
PHmaster has joined #ocaml
PHmaster has left #ocaml []
rby_ has quit [Read error: 110 (Connection timed out)]
rwmjones_afk is now known as rwmjones
vpalle has quit [Read error: 110 (Connection timed out)]
hkBst has joined #ocaml
jeddhaberstro has joined #ocaml
_andre has quit ["Lost terminal"]
Snark has quit ["Ex-Chat"]
rog1 has quit [Read error: 110 (Connection timed out)]
guillem has joined #ocaml
|jedai| has joined #ocaml
mbishop_ is now known as mbishop
Linktim_ has quit ["Quitte"]
psnively has joined #ocaml
Jedai has quit [Read error: 110 (Connection timed out)]
Oatschool has quit ["Leaving"]
rwmjones_ has joined #ocaml
lorph has joined #ocaml
<lorph> is there a sockets library
<psnively> Sure. It's even built-in.
<psnively> You really don't want to use raw sockets, though.
<psnively> In all likelihood, I mean.
<psnively> Or maybe http://jocaml.inria.fr
GustNG has quit [Read error: 104 (Connection reset by peer)]
tomh_-_ has joined #ocaml
subconscious has quit [Read error: 113 (No route to host)]
subconscious has joined #ocaml
Inglorion has joined #ocaml
<Inglorion> hi all
<psnively> Hello. :-)
<Inglorion> quick question: i have a program in which i write basically try ... with error -> ...
<Inglorion> now i want to print the error message
<Inglorion> how can i do that?
<lorph> psnively: oh its not cross platform?
hkBst has quit [Read error: 104 (Connection reset by peer)]
<psnively> Sorry, what's not cross-platform?
<lorph> the socket library
<psnively> The socket library is. Parts of the rest of the UNIX library are not.
xevz has joined #ocaml
<lorph> when I try to use it, I get Reference to undefined global 'Unix'
Associat0r has joined #ocaml
<Inglorion> lorph: compiling or toplevel?
<lorph> toplevel
<Inglorion> did you #load "unix.cma" ?
marmotine has quit ["mv marmotine Laurie"]
rwmjones_ has quit ["Closed connection"]
<lorph> oh no
<Inglorion> you need to do that. when compiling, you need to do something like "ocamlc unix.cma <other stuff>" or "ocamlopt unix.cmxa <other stuff>"
<lorph> i'm just looking at examples and they don't load the cma file
<Inglorion> are the examples intended to be used in the toplevel or in files that are compiled?
guillem has quit [Remote closed the connection]
<olegfink> Inglorion: which error message?
<olegfink> exceptions may contain any values
<Inglorion> indeed
<olegfink> i.e., exception EverythingGoneBad of string
<Inglorion> i don't know what sort of exception i will catch
<olegfink> then you do try ... with EverythingGoneBad s -> print_endline s
<Inglorion> i would like to just say "whatever went wrong, print the error message that would be printed if i hadn't caught the exception"
Kopophex has joined #ocaml
<Inglorion> the best i've been able to come up with is "try ... with error -> output_value stderr error"
<Inglorion> but that prints something vaguely garbage-like, as you can imagine :p
<lorph> Inglorion: i don't know
<olegfink> ah, hm. interesting indeed.
<olegfink> so you basically want a functions that prints a human-readable representation of an arbitrary data structure?
<olegfink> s/functions/function/
<Inglorion> well, that would be insanely great
<Inglorion> but i'll settle for a function that prints a human-readable representation of an exception
<psnively> Which the toploop has...
<Inglorion> yes, good point, psnively
<olegfink> psnively: and what about compiled code?
<psnively> What about it?
<subconscious> hi
<olegfink> it still prints the "contents" of an exception
<olegfink> do I have access to this functionality?
<psnively> Ah. Unfortunately, no, the generic print function is not generally available.
<psnively> (It's magic.)
<olegfink> i.e., is there a function which outputs what the loop prints after each expression?
seafood has joined #ocaml
<olegfink> ah
<psnively> Yes, there is... in the source code of the toploop. It relies on Obj.magic and isn't fit for general consumption. :-D
seafood has quit [Read error: 104 (Connection reset by peer)]
<psnively> Hm, but I think people have done similar things. Let me dig.
<Koordin> hi, how can i match a constructor which has an optional argument ?
<Inglorion> i think i found something
<Inglorion> the module Printexc
<Koordin> noone knows ?
<olegfink> val to_string : exn -> string
<olegfink> (** [Printexc.to_string e] returns a string representation of
<olegfink> the exception [e]. *)
<olegfink> here we go, Inglorion :-)
<olegfink> thanks, psnively
<olegfink> sounds like a bunch of fun for the evening
<olegfink> heh, and Printexc's implementation is magic indeed
<Inglorion> it has to be :p
<psnively> Oh, that's for MetaOCaml. Nevermind.
<Inglorion> as far as i know, you can't really do anything with values of type exn
<Inglorion> but well. this does _almost_ what i want
<Inglorion> at least it's sort of human-readable
<Inglorion> 'Unix.Unix_error(20, "connect", "")'
<Koordin> hi, how can i match a constructor which has an optional argument ?
<psnively> BBIAB
psnively has quit []
<Inglorion> Koordin: i'm sorry, i don't know
<Koordin> i have this error
<Koordin> This expression has type Cparse.loc_expr option but is here used with type
<Koordin> Cparse.loc_expr = Error.locator * Cparse.expr
<Koordin> because i'm trying to send a Cparse.loc_expr option to a function which takes as an argument a Cparse.loc_expr
<Inglorion> well, in that case ...
<Inglorion> you should do something like
<Inglorion> match your_option with
<Inglorion> | None -> (* do something in case your_option is None *)
<Inglorion> | Some value -> (* call your function with value *)
<Koordin> ok thanks
<Koordin> i'll try and tell you
<Koordin> i'll try and then tell you*
<Koordin> | CRETURN (None) -> print_string "CRETURN"
<Koordin> | CRETURN (locexpr) -> print_string "CRETURN" ; print_loc_expr locexpr
<Koordin> i've tried this, but i is still telling me that locexpr is Cparse.loc_expr option
<Koordin> it*
Yoric[DT] has quit ["Ex-Chat"]
<Inglorion> i think you forgot "Some"
<Koordin> (knowing that CRETURN is defined like that CRETURN of loc_expr option and knowing that print_loc_expr that as an argument a loc_expr)
<Koordin> oh, it's a keyword
<Koordin> where can i put it ?
<Koordin> is the parenthesis ?
<Koordin> CRETURN (Some locexpr) ?
<Inglorion> here's a quick example of how to deal with option types:
<Inglorion> let print_maybe_int x = match x with
<Inglorion> | None -> ()
<Inglorion> | Some n -> print_int n
<Inglorion> possible values of x would be like "None", "Some 12", "Some 42", etc.
<Koordin> ok
<Inglorion> hope that helps
<Inglorion> i need to go catch some zzzs
<Koordin> so here, what is the type of print_maybe_int ?
<Koordin> int option -> unit ?
<Inglorion> yes
<Koordin> ok
<Inglorion> unless i botched it :p
<Koordin> :D
<Inglorion> anyway, i got my spam filter working and printing sane error messages
<Inglorion> time to call it a night :-)
Inglorion has left #ocaml []
<Koordin> this didn't work
<Koordin> This pattern matches values of type ('a * 'b) option
<Koordin> but is here used to match values of type
<Koordin> Cparse.loc_expr = Error.locator * Cparse.expr
<Koordin> could someone else help me please ? i think it's an easy issue
<Koordin> please ?
<Koordin> This pattern refers to "None"
<Koordin> i can't understand why this isn't working
<subconscious> Koordin, what's the problem?
<xevz> Koordin: How do you call the function?
<Koordin> | CRETURN (locexpr) -> print_string "CRETURN" ; print_loc_expr locexpr
<Koordin> within a "match"
<xevz> print_loc_expr (Some locexpr)
<subconscious> Koordin, ...and what's the problem?
<Koordin> the problem is that it isn't compiling
<subconscious> why not?
<xevz> Unless locexpr already is of type "loc_expr option"...
<Koordin> File "compile.ml", line 57, characters 4-8:
<Koordin> This pattern matches values of type ('a * 'b) option
<Koordin> but is here used to match values of type
<Koordin> Cparse.loc_expr = Error.locator * Cparse.expr
wlmttobks has quit ["Leaving"]
<subconscious> Koordin, so what this means is that ('a * 'b) option and Error.locator * Cparse.expr don't match
<subconscious> like xevz guessed, you must have a (Error.locator * Cparse.expr) option
wlmttobks has joined #ocaml
<Koordin> yes but i can't see where the problem is
<subconscious> the problem is that the types do not match
ctsprsrcl has joined #ocaml
<Koordin> yes but i can't understand why
<Koordin> i've tried what xevz and i still have the same problem
<subconscious> one thing takes a type ('a * 'b) option but another thing is trying to force Error.locator * Cparse.expr into it
<Koordin> i've written print_loc_expr in order it takes Cparse.loc_expr option = (Error.locator * Cparse.expr) option
<Koordin> so i don't see where the problem is
<Koordin> print_loc_expr is written in the pastebin
<subconscious> Have a look at line 57
<Koordin> line 57 is the line 4 in the pastebin
<Koordin> None -> () ; that's pretty common, isn't it ?
<Koordin> does someone have an idea for the source of the problem ?
<subconscious> yes, I do
<subconscious> I still think it's a type error, just like I said
<Koordin> yes i understand and i know it is
<Koordin> but i can't see where it is coming from
<Koordin> print_loc_expr takes as an argument an option
<Koordin> (just as written in the pastebin)
<Koordin> and CRETURN has as an argument an option too
wlmttobks has quit [K-lined]
<Koordin> so i'm sending an option to a function that takes as an argument an option
<Koordin> so it is weird that is doesn't work
<Koordin> " | CRETURN of loc_expr option " <- the definition of CRETURN
<Koordin> any idea ?
DroneZilla has left #ocaml []
<Koordin> maybe someone else ?
<Koordin> hm
<Koordin> i'll try somewhere else
<Koordin> thanks for your help
tomh_-_ has quit ["http://www.mibbit.com ajax IRC Client"]
Koordin has quit [Remote closed the connection]
Kopophex has quit ["Leaving"]