gildor changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 3.12.0 http://bit.ly/aNZBUp
lopexx has quit []
lopex has joined #ocaml
mal`` has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
mal`` has joined #ocaml
lopex has quit []
hto_ has quit [Read error: Operation timed out]
hto has joined #ocaml
philtor has joined #ocaml
smerz has quit [Quit: Ex-Chat]
arubin has joined #ocaml
myu2 has quit [Remote host closed the connection]
enthymeme has quit [Ping timeout: 255 seconds]
mrvn has quit [Ping timeout: 260 seconds]
myu2 has joined #ocaml
<kaustuv_> thelema: ocaml doesn't use setjmp/longjmp for exceptions if that is what you're asking
mrvn has joined #ocaml
ccasin has quit [Read error: Operation timed out]
myu2 has quit [Remote host closed the connection]
joewilliams is now known as joewilliams_away
<thelema> kaustuv_: then how is ocaml's exception handling faster than c++?
npouillard has quit [Read error: Operation timed out]
npouillard has joined #ocaml
npouillard has quit [Ping timeout: 260 seconds]
<kaustuv_> thelema: exceptions in ocaml are simple jumps. Generally speaking they will be at least an order of magnitude faster than C++.
<kaustuv_> a rough analogy would be every function carrying an "exception stack" (although such an object is not explicitly built), and when you raise an exception you just jump (i.e., tail call) to this stack.
<kaustuv_> you can easily see this by writing a recursive function that wraps a try ... with around the recursive call and reading the assembly
astory has joined #ocaml
<thelema> yes, I guess I may have to do this.
<astory> I'm having a really dumb moment; I can't manage to import the Map module; what is the right way to do it?
<thelema> astory: you don't have to import it, just use it
<astory> thelema: Error: Unbound constructor Map.Make
<thelema> . that's odd... how are you building
<kaustuv_> Map.Make (String)
<kaustuv_> The brackets are not optional
<astory> kaustuv_: that's what I called
<astory> I'm running this in the toplevel right now
<kaustuv_> module M = Map.Make(String);;
<astory> that does it, sorry for the bother
npouillard has joined #ocaml
astory has left #ocaml []
tauntaun has joined #ocaml
hcarty has quit [Ping timeout: 276 seconds]
hcarty has joined #ocaml
myu2 has joined #ocaml
joewilliams_away is now known as joewilliams
tauntaun has quit [Ping timeout: 246 seconds]
arubin has quit [Quit: arubin]
philtor has quit [Ping timeout: 246 seconds]
joewilliams is now known as joewilliams_away
ulfdoz has joined #ocaml
vivanov has joined #ocaml
emmanuelux has quit [Quit: =>[]]
Cyanure has joined #ocaml
ikaros has joined #ocaml
ulfdoz has quit [Quit: deprecated]
surikator has quit [Quit: Scientific discovery is just maximal compression of random strings. Nothing more, nothing less.]
ygrek_ has joined #ocaml
Yoric has joined #ocaml
Cyanure has quit [Remote host closed the connection]
Oejet has joined #ocaml
Yoric has quit [Quit: Yoric]
larhat has joined #ocaml
ikaros_ has joined #ocaml
ikaros has quit [Ping timeout: 260 seconds]
edwin has joined #ocaml
ftrvxmtrx has quit [Quit: Leaving]
Oejet has quit [Ping timeout: 276 seconds]
Snark has joined #ocaml
Oejet has joined #ocaml
kaustuv_ has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
ygrek_ has quit [Remote host closed the connection]
Oejet has quit [Ping timeout: 276 seconds]
Yoric has joined #ocaml
Yoric has quit [Quit: Yoric]
Yoric has joined #ocaml
ikaros_ has quit [Quit: Leave the magic to Houdini]
ftrvxmtrx has joined #ocaml
ikaros has joined #ocaml
ftrvxmtrx has quit [Quit: Leaving]
ftrvxmtrx has joined #ocaml
ftrvxmtrx_ has joined #ocaml
ftrvxmtrx has quit [Ping timeout: 276 seconds]
avsm has joined #ocaml
ikaros has quit [Quit: Leave the magic to Houdini]
robthebob has joined #ocaml
boscop has joined #ocaml
noj has quit [Ping timeout: 276 seconds]
ftrvxmtrx_ is now known as ftrvxmtrx
myu2 has quit [Remote host closed the connection]
noj has joined #ocaml
<vivanov> how to load some libraries by default using findlib in toploop after i type #use "topfind"?
<vivanov> do not want to type #require "unix";; #require "threads" every time
<fx_> .ocamlinit
lopex has joined #ocaml
<vivanov> fx_ : thanks
ftrvxmtrx has quit [Quit: Leaving]
ftrvxmtrx has joined #ocaml
tauntaun has joined #ocaml
<thelema> fx_: hudson batteries is stopped?
<fx_> thelema, shouldn't be
<fx_> let me check
<fx_> hm, some errors
vivanov has quit [Quit: Lost terminal]
eye-scuzzy has quit [Remote host closed the connection]
eye-scuzzy has joined #ocaml
<thelema> fx_: thanks
<adrien> bah, what's the "general" reason ocaml tells me "values do not match: '$some_sig' is not included in '$some_sig'" when using objects?
hyperboreean has quit [Ping timeout: 250 seconds]
ikaros has joined #ocaml
hyperboreean has joined #ocaml
<thelema> adrien: $somesig1 != $somesig2
<thelema> but that's not what you want to hear
<adrien> same string on screen at least
<thelema> pastebin?
tauntaun has quit [Ping timeout: 240 seconds]
<adrien> gah, found it: typo... "scrollable" / "scrollbale"
<adrien> I think I might wrap ocaml{c,opt}'s output to gvimdiff or something like that
<fx_> thelema, ok, fixed, thanks for heads up
<thelema> fx_: no problem
<kaustuv> thelema: re the cache thingy you set up, I presume you are not worried about space leaks by keeping the cached results alive?
<kaustuv> because otherwise you should be using a weak hashtable
<thelema> kaustuv: huh? using a weak hashtable as a cache seems a good way to cache nothing
<kaustuv> incidentally, cache_ht and cache_map don't have compatible semantics because Hashtbl.add keeps the old bindings around. In order to make them roughly the same you'd need to use Hashtbl.replace.
<thelema> kaustuv: good point on that
<thelema> well, except there should only be one binding at a time
<kaustuv> well, a weak table guarantees that things that are referenced from the rest of the program continue to be present in the table, so you would still get the benefit of preventing duplicate computation
<thelema> except for if I have a copy of the results elsewhere, I find myself not needing to look that up again
<kaustuv> sure, which is why I asked about space leaks
<thelema> yes, big warning labels - if you don't have a small set of keys or delete cache entries you don't need anymore, this will leak memory
<thelema> fwiw, my original use for this is associating parsers with TCP flows
myu2 has joined #ocaml
avsm2 has left #ocaml []
<kaustuv> the bigger problem seems to be that what I was proposing with weak hash tables is not apparently doable in OCaml < 3.12
<kaustuv> Here's a 3.12+ solution: http://pastebin.com/QrH5KACz
<thelema> kaustuv: doesn't that empty every Gc unless the returned tuple is still live (as opposed to just the s2 component)?
dnolen has joined #ocaml
<kaustuv> good question. I don't know.
Yoric has quit [Ping timeout: 276 seconds]
<kaustuv> yes, you are correct, the table gets emptied on every major collection
<kaustuv> as the French say, sorry for the noise.
Yoric has joined #ocaml
kaustuv has quit [Quit: reboot]
seafood has joined #ocaml
Cyanure has joined #ocaml
alin_ has joined #ocaml
Yoric has quit [Quit: Yoric]
Yoric has joined #ocaml
Yoric has quit [Read error: Connection reset by peer]
Yoric has joined #ocaml
ikaros has quit [Quit: Leave the magic to Houdini]
seafood has quit [Ping timeout: 264 seconds]
ymasory has joined #ocaml
npouillard has quit [Ping timeout: 248 seconds]
philtor has joined #ocaml
myu2 has quit [Remote host closed the connection]
dnolen has quit [Quit: dnolen]
lopex has quit []
ftrvxmtrx has quit [Remote host closed the connection]
ftrvxmtrx has joined #ocaml
ikaros has joined #ocaml
ftrvxmtrx_ has joined #ocaml
ftrvxmtrx has quit [Ping timeout: 276 seconds]
ccasin has joined #ocaml
tauntaun has joined #ocaml
ygrek_ has joined #ocaml
lopex has joined #ocaml
ftrvxmtrx_ has quit [Quit: Leaving]
tauntaun has quit [Quit: Ex-Chat]
ygrek_ has quit [Ping timeout: 246 seconds]
guest32767 has joined #ocaml
vivanov has joined #ocaml
Yoric has quit [Ping timeout: 252 seconds]
alin__ has joined #ocaml
Yoric has joined #ocaml
alin__ has quit [Client Quit]
alin_ has quit [Ping timeout: 276 seconds]
guest32767 is now known as ezrak
AdmWiggin has quit [Ping timeout: 260 seconds]
Tianon has joined #ocaml
Tianon has quit [Changing host]
Tianon has joined #ocaml
ygrek_ has joined #ocaml
Yoric has quit [Ping timeout: 246 seconds]
larhat has quit [Quit: Leaving.]
joewilliams_away is now known as joewilliams
<vivanov> inside ocaml code, how to refer to option arguments passed to a program? $ ./ocamlprogram -i input -o output. something to do with Sys.argv?
<flux> vivanov, indeed, the arguments are stored in that array. you can use the Arg module for somewhat conveniently parsing them.
<flux> but be warned that many people have written their own command line parser, having not been completely satisfied by the stock one :).
<flux> but it does the job.
<vivanov> thanks :)
ygrek_ has quit [Ping timeout: 246 seconds]
smerz has joined #ocaml
eelte has quit [Read error: Operation timed out]
vivanov has quit [Ping timeout: 276 seconds]
ymasory has quit [Ping timeout: 246 seconds]
<thelema> grrr... (input.[pos] |> Char.code) makes my program run half as fast as (Char.code input.[pos])
eelte has joined #ocaml
* thelema expected the optimizer clean up |>
ftrvxmtrx has joined #ocaml
vivanov has joined #ocaml
ymasory has joined #ocaml
sepp2k has joined #ocaml
ulfdoz has joined #ocaml
er98052 has joined #ocaml
<er98052> does anyone know if this channel is logged somewhere?
<thelema> er98052: yes
<er98052> nice, thanks!
<hcarty> thelema: Is this from "ocaml foo.ml", bytecode or native code?
<hcarty> thelema: But I vaguely remember someone stating a lack of optimization as an argument against |> and friends
<thelema> hcarty: no, native code
<thelema> If I could, I'd give ocamlopt the right special cases to handle them.
<thelema> luckily, my inner loops don't have any |> left in them
<hcarty> There is an example in pa-do to optimize it away
* thelema looks up the inliner's rules again
<thelema> http://alan.petitepomme.net/cwn/2010.02.09.html#2 nope, |> should be inlineable
yezariaely has joined #ocaml
DimitryKakadu has joined #ocaml
yezariaely has left #ocaml []
Yoric has joined #ocaml
<mrvn> LD_LIBRARY_PATH=$(pwd)/chroot_armel/?
<mrvn> ups
caligula_ has joined #ocaml
caligula__ has quit [Remote host closed the connection]
ygrek_ has joined #ocaml
Snark has quit [Quit: Ex-Chat]
<mfp> thelema: functional parameters from HOFs are not inlined, but see http://caml.inria.fr/mantis/view.php?id=5236
ymasory has quit [Ping timeout: 276 seconds]
<thelema> mfp: ah, nice
<thelema> http://caml.inria.fr/mantis/view.php?id=5225&nbn=2#bugnotes <- This would explain some bad performance I've seen with hashtables and complex objects
ymasory has joined #ocaml
confound has quit [Quit: leaving]
vivanov has quit [Ping timeout: 260 seconds]
ymasory has quit [Ping timeout: 260 seconds]
vivanov has joined #ocaml
ymasory has joined #ocaml
Oejet has joined #ocaml
<hcarty> There is a recently created namespaces branch in OCaml's Subversion tree.
<hcarty> That could be promising
<adrien> do you have any description of what it is,
<adrien> ?
<hcarty> adrien: I'm looking through it a bit now. It looks, at this point, like file x.ml in directory A gives you module A.X
<hcarty> adrien: It also looks like you can define a namespace/module space in a file
<adrien> oh =)
<hcarty> adrien: Using syntax like "in Foo.Bar" in x.ml would give you a module Foo.Bar.X
<adrien> could be useful to me pretty soon :-)
<hcarty> The README looks quite promising
<thelema> except that the -namespace flag is quite clunky
<adrien> "link several modules with the same name, as soon as they are in different namespaces" <- me very happy
<adrien> thelema: maybe like -labels, might become the default later on
<hcarty> thelema: Possibly so. The "in Foo.Bar" syntax (or something similar) may become more standard
<thelema> hcarty: yes, "in Foo.Bar" definitely seems better
<hcarty> I like "open Foo as Bar" too
<thelema> trying to use
<thelema> X.Y.Z to access a module compiled as Z in directory x/y will generate
<thelema> an error.
<thelema> :(
<hcarty> thelema: Hopefully that either gets worked out, or ends up being a non-issue in practice
<adrien> also, that "module X = Y" create a new module that appeared in the .cmi (and duplicated code?) has been annoying me quite a lot, I'm very happy to see it might be solved soon
<adrien> honestly, I hope I can rely on ocamlbuild and never bother with the details of that
EM03 has joined #ocaml
<EM03> hows ocaml development been lately?
<EM03> any new releases new features? any performance improvements?
<thelema> EM03: we were just discussing the namespaces feature in SVN
<adrien> last release is from last august but I think we should see a new one quite soon (before the end of 2011 is almost guaranteed)
<EM03> how is performance been lately?
<EM03> I'm thinking about doing a project either in scheme or ocaml for a website hehe
<EM03> I think i might choose ocaml
<thelema> EM03: if you're doing a web app, performance rarely matters
<EM03> thelema: of course
<EM03> but if I'm doing something for fun ...its nice to say its at least really fast :P
<thelema> well, ocaml is still quite fast.
<adrien> I'm doing my best to write slow ocaml code but it's really hard and I haven't really suceeded yet ='(
<EM03> heh yea
<EM03> benchmarks show it to be pretty fast
avsm has quit [Ping timeout: 246 seconds]
<hcarty> EM03: OCaml's performance is nicely predictable
<EM03> yea
<EM03> what do you guys think of scheme?
<thelema> EM03: not so much - it's dynamically typed, right? That's bad.
<EM03> but its scheme!
<hcarty> EM03: So it's up to something
ygrek_ has quit [Ping timeout: 246 seconds]
ulfdoz has quit [Ping timeout: 250 seconds]
yezariaely has joined #ocaml
<thelema> EM03: if you're doing huge array manipulation, go ahead and use scheme.
<EM03> I'm doing fun stuff thelema :)
<hcarty> thelema: Why scheme over OCaml in that case?
<thelema> hcarty: whole program optimization, better float arrays (bigarray has some implementation deficiencies, notably too many indirections)
<hcarty> Ah. I found standard float arrays in OCaml to be plenty fast - but most of the float-heavy processing I've done has also been I/O heavy.
<hcarty> Or the significant computational work was done by C or Fortran (GSL or LAPACK)
<thelema> ocaml's float arrays aren't so bad. But on 32-bit platforms, they're limited in size
<EM03> this is just a simple web application :)
DimitryKakadu has quit [Remote host closed the connection]
<hcarty> OCaml should be fast and fun to learn in that case. And you have two to four levels of fast available, depending on how you count them... ~interpreted toplevel code; bytecode; native code as a sort-of script; and native code.
<EM03> I used to use ocaml pretty heavily back in 04
<hcarty> EM03: Ah. In that case it will just be fast and fun :-)
yezariaely has quit [Quit: Leaving.]
<thelema> EM03: I'll have to say that not too much has changed since then in terms of performance or the fundamentals. There's been some nice additions in the type system, and some community infrastructure (batteries, oasis) that's developing well, but it'll still be pretty much the same old ocaml.
<thelema> oh yeah, except there's ocamlbuild now, which makes lots of the pain of compiling go away
<EM03> ah cool stuff then
<EM03> maybe i should do it in both ocaml and scheme heh
<EM03> I'm really a full time PHP dev ... hehe
<thelema> why'd you quit ocaml?
<EM03> my job
<EM03> and i used a bunch of other things like rails and python during that time
<thelema> just curious about what people's pain points are re: ocaml
<EM03> the web development scene is not really strong in either language
<thelema> you might be surprised - ocsigen and yoric's thing are both ocaml web frameworks that use the power of static typing to guarantee good html
seafood has joined #ocaml
<EM03> thelema: not sure how i feel about static typing for web dev heheh
<thelema> EM03: me neither - I like sinatra's style (though I've never used it)
<EM03> the ruby framework?
<thelema> isn't it python?
<EM03> sinatra is ruby last i checked
<thelema> you're right
<adrien> EM03: ocsigen uses types to guarantee its output is xhtml-valid
<EM03> and btw thats just more of the same
<EM03> sinatra is just more of the same
<EM03> they are beating a dead horse with those mini frameworks
Associat0r has joined #ocaml
<thelema> EM03: just because there's a lot of mini frameworks means they're bad?
<EM03> not its not bad but for someone who has been using them for 8 years it gets boring
<EM03> and its time for a new pattern
<EM03> well to improve the patttern a bit
<thelema> well ocsigen definitely is a new pattern. I can't say it's the right one.
<EM03> it is
<EM03> seaside the smalltalk framewok has a pattern as well
<EM03> don't think thats the right one either
<hcarty> I'm not sure I see why static typing would be any worse for web development than it is for any other domain.
seafood has quit [Read error: Connection reset by peer]
seafood has joined #ocaml
<thelema> hcarty: maybe because browsers are loose about what input they'll accept (so one's output doesn't have to be 100% correct)
<EM03> more time consuming and types change alot on the web
ymasory has quit [Remote host closed the connection]
tauntaun has joined #ocaml
<hcarty> EM03: If the whole framework is typesafe then I don't think it would make anything more time consuming - but I haven't tested this theory :-)
<thelema> EM03: types changing a lot isn't generally a problem for ocaml
<hcarty> EM03: Frequent type changes would be an argument for static type checks I would think
<hcarty> Catch any missed code changes before they introduce a bug or security hole
tauntaun is now known as tauntaun_away
seafood has quit [Ping timeout: 250 seconds]
er98052 has quit [Quit: er98052]
srcerer_ has joined #ocaml
srcerer_ is now known as release
srcerer is now known as Guest91345
Guest91345 has quit [Ping timeout: 240 seconds]
tauntaun_away has quit [Quit: Ex-Chat]
release is now known as srcerer_
srcerer_ is now known as srcerer
edwin has quit [Remote host closed the connection]
_y_ has joined #ocaml
<_y_> is it possible to write code that operates over differing instances of the same module signature?
<thelema> _y_: functors
<_y_> let's say I have a module definition which corresponds to some collection of elements, parameterized over type 'a, and the module exports a function which allows me to retrieve the elements one-by-one (let's say internally they're stored in an array, and I can access them like WhateverModule.element_at n, where n < WhateverModule.size ()), and I want to write a function that returns a list of the elements
<_y_> is this possible?
<thelema> yes, but that function will have to be in a module
<hcarty> First-class modules allow this too
<thelema> module type RandomAccess = sig type 'a t val get : 'a t -> int -> 'a val size 'a t -> int end
<thelema> module Listify (RA:RandomAccess) = struct let to_list x = ... RA.size x ... RA.get x i ... end
<_y_> brilliant
<_y_> very helpful as always thelema, I owe you a beer one of these days
<thelema> n/p
srcerer has quit [Quit: ChatZilla 0.9.86 [Firefox 3.6.15/20110303024726]]
srcerer has joined #ocaml
tauntaun has joined #ocaml
<mrvn> thelema: isn't specifying the type as 'a. 'a RandomAccess.t -> 'a list enough?
<thelema> mrvn: RandomAccess is a module type - how to get the concrete [get] and [size] functions without a module body?
<mrvn> right, nm.
kaustuv has joined #ocaml
<kaustuv> > It also means that, until everybody start using namespaces, libraries should be compiled twice, once with namespaces (the new way) and once without namespaces (the old way), and installed in different trees.
<kaustuv> (from the README for the namespaces branch)
ymasory has joined #ocaml
Oejet has quit [Quit: Leaving.]
Oejet has joined #ocaml
<kaustuv> I hope this doesn't lead to Javafication. I would hate to see module paths such as Com.Wizbang.Zoinks.Doodah
Amorphous has quit [Ping timeout: 276 seconds]
Cyanure has quit [Remote host closed the connection]
ikaros has quit [Quit: Leave the magic to Houdini]
Amorphous has joined #ocaml
<mrvn> I just want to see a submodule == subdir optional equivalenz.
<mrvn> e.g. I want to have foo.mli, foo/bar.ml, foo/baz.ml and then use Foo.Bar.t
boscop has quit [Ping timeout: 246 seconds]
<mrvn> And in foo/bar.ml Baz.t should consider foo/baz.cmi while in blub.ml Foo.Baz.fn should consider foo.cmi if available.
sepp2k has quit [Quit: Leaving.]
<hcarty> kaustuv: I hope it is more Perl-like in its results - A Net.* hierarchy, a Map.* hierarchy...
myu2 has joined #ocaml
<mrvn> The only hierachy that is important is Batteries.*
<kaustuv> I actually don't mind Haskell's layout (although it isn't without flaws), if only because things like 'Net' at the topmost level would tend to produce collisions (Net::Neural vs. Net::Socket).
<mrvn> I would put that under Sim::Net::Neural
<kaustuv> 'Batteries' is a *terrible* name for the root of a namespace hierarchy. I'm sure you are being facetious.
<mrvn> kaustuv: I ment to hint that batteries has everything you ever need
<mrvn> n8
thieusoai has joined #ocaml
<kaustuv> That's what Batteries needs, advertising jingles based on old Rolling Stones songs. 'You can't always get what you want, but if you use Batteries, you find that you get what you need.'
thieusoai has quit [Remote host closed the connection]
Yoric has quit [Quit: Yoric]
<kaustuv> This is really weird:
<kaustuv> # module rec M : sig val f : 'a -> 'b end = M ;;
<kaustuv> module rec M : sig val f : 'a -> 'b end
<hcarty> kaustuv: Very weird. "Exception: Undefined_recursive_module ("", 1, 42)."
lamawithonel has quit [Read error: Operation timed out]
<hcarty> When trying to call M.f
<hcarty> kaustuv: That looks like it may be a bug
<kaustuv> it seems to be technically valid according to the semantics of recursive modules
<kaustuv> But I do think that I've discovered a bug where the inferred types are all wrong. Trying to create a reproducible case.
<hcarty> I guess if there is a run-time exception defined for it then it may be an accepted possibility.
alexyk has joined #ocaml
ftrvxmtrx has quit [Quit: Leaving]
<kaustuv> Looks like there is some kind of explicit loop breaking in the compiler because this works (albeit with unexpected results): http://pastebin.com/VJ26qpZm
<alexyk> I marshalled a bunch of data into .mlb files (that's what I call marshalled ocaml binary data) and then compressed them with xz. Is there a way to unmarshal them from a stream, without decompressing into the .mlb on disk?
<alexyk> or, how can I open a channel from say xzcat output on a file?
<kaustuv> let load_mlb mlbfile = Marshal.from_channel (Uniz.open_process_in ("xzcat " ^ mlbfile))
<kaustuv> err, Unix
<kaustuv> to do it properly you would also call Unix.close_process_in after you've marshalled enough data so that the child process can be gc'd
<alexyk> cool, thx!
<alexyk> Unix.open_process_in has ~?autoclose:bool -> ~?cleanup:bool in Batteries
<kaustuv> yes, but they just add stuff to at_exit(). That can be OK if your program doesn't run for a long time or doesn't read too many mlb files; otherwise, just use close_process_in explicitly.
<alexyk> kaustuv: is this OK: let load_mlbxz mlbfile = let pin = Unix.open_process_in ("xzcat " ^ mlbfile) in let r = Marshal.from_channel pin in Unix.close_process_in pin; r
<kaustuv> Depends on your paranoia level. This might be marginally better in the sense that it doesn't leak file descriptors: http://pastebin.com/AqBM3MrH