sgnb has quit [Read error: Connection reset by peer]
sgnb has joined #ocaml
oriba_ has joined #ocaml
oriba_ has quit [Read error: Connection reset by peer]
lamawithonel_ has quit [Read error: Connection reset by peer]
ygrek has quit [Ping timeout: 250 seconds]
bacam has joined #ocaml
<adrien>
NaCl: should be something like "Lwt_glib.init ()", nothing more than that
<adrien>
the rest is automatic
fraggle_ has quit [Remote host closed the connection]
fraggle_ has joined #ocaml
<likebike>
I was watching one of the lecture videos on the Janestreet website, and Yaron Minsky said something to the effect of "OCaml has object-oriented support, but nobody uses it! Even the creator of the object system doesn't use it." Would you guys say this is a fairly accurate statement?
<ezyang>
That was certainly my impression of it.
<rproust>
the creator uses the OO type system for typing JS objects in js_of_ocaml
<likebike>
I was reading about the object system, and the need to always deal with "explicit" types seemed to make things complex.
<flux>
some use it, for example ocamlnet
<adrien>
lablgtk uses objects so actually, people do use it
<flux>
the thing about ocaml oo is that it is sort of an advanced subject
<adrien>
that was an exageration
<flux>
you might end up with curious error messages which can be difficult to understand
<adrien>
what flux said, and it's good to tell learners not to use oo in ocaml: better wait a bit
<flux>
but, ocaml's oo is a great system in any case
<adrien>
I've seen several people jump to oo in ocaml immediately, and that's not a good thing
<likebike>
ok, thanks
<hcarty>
likebike: I jumped in to OCaml's OO support early in my OCaml learning time. I thought it was very cool, used it everywhere in my code... and was then bitten horribly because I hadn't used it properly.
<likebike>
haha. k. I'll wait a while. :)
<hcarty>
likebike: The OO system in OCaml is very cool, but it requires a different kind of discipline from a user
<hcarty>
It's worth learning! But it's important to remember that the compiler doesn't protect as nicely as it does when using a functional programming style.
<hcarty>
Protect the programmer that is... as flux said, the error messages can become cryptic and/or HUGE
zsparks has quit [Ping timeout: 276 seconds]
boscop_ has joined #ocaml
boscop has quit [Ping timeout: 250 seconds]
lamawithonel has joined #ocaml
munga has quit [Ping timeout: 258 seconds]
vivanov has quit [Quit: Lost terminal]
Tommytom has joined #ocaml
boscop_ has quit [Ping timeout: 255 seconds]
<thelema>
gildor: check out batteries/examples/euler/mathlib.ml
<thomasga>
does ocaml-installer still alive ? the hg repository seems to be dead on ocamlforge
thelema_ has joined #ocaml
<f[x]>
gildor, is there some stable url to download latest version of package from oasis-db?
thelema has quit [Ping timeout: 240 seconds]
<f[x]>
i.e. without version number
<thelema_>
f[x]: at the moment, you can do that in two steps: first get oasis.ocamlcore.org/dev/odb/unstable/pkg/info/<pkgname>
<f[x]>
ok, I see
<thelema_>
this is a simple key=value file, the key `tarball` has the name of the latest version
<Tommytom>
Hello, how can I give an object to a arg method of current class ?
<thelema_>
Tommytom: you want to pass an object as a method parameter?
<Tommytom>
yes but an instance of current class
ftrvxmtrx has quit [Quit: This computer has gone to sleep]
<thelema_>
class foo = object (self: 'mytype) method another_me : 'mytype -> unit = fun obj -> ... end
barismetin has joined #ocaml
<Tommytom>
but
<Tommytom>
here
<Tommytom>
method sendOtherPck c =
<Tommytom>
let i = 0 in
<Tommytom>
while (i < (List.length c#list_pck)) do
<Tommytom>
Where c is the object
<thelema_>
the key is the (self: 'mytype) after `object` combined with marking the argument as mytype
<thelema_>
but why don't you want the inferred type?
<Tommytom>
I don't know what it is inferred type.
<thelema_>
if you just use c as an object, its type will be inferred based on how you use it, including what methods it needs and the type of those methods
<thelema_>
you don't need to do anything special
<Tommytom>
mmh okok
<gildor>
thomasga: hg repository for ocaml-installer: ssh://scm.forge.ocamlcore.org//hgroot/ocaml-installer/ocaml-installer
<gildor>
thomasga: but latest commit is pretty old
<thomasga>
ok thanks
sepp2k has joined #ocaml
Dalida has joined #ocaml
<Dalida>
helo, were can i find a list of projects based on ocaml, and what are best and most recent books on this language?
<thelema_>
Dalida: forge.ocamlcore.org has many ocaml projects
edwin has quit [Ping timeout: 255 seconds]
<rproust>
Tommytom: you seem to be using the i as a variable in you pasted example
Dalida has quit [Quit: Page closed]
<rproust>
`let i = 0 in while (i< e1) do e2 done` either loops indefinitely or does nothing but evaluating e1
<rproust>
ohh
<rproust>
my mistake
<rproust>
nevermind
nullllun has joined #ocaml
<f[x]>
thelema_, what is used as package name in url - findlib name or what?
<f[x]>
see - pkg/info/oUnit and dev/dist/ounit
<gildor>
thelema_: mathlib -> indeed useful, but I was more thinking about prime number generator
<gildor>
thelema_: BTW, int for factorial is a bit an "underestimate" for euleur problmes ;-)
<gildor>
thelema_: big_int is the least we can expect
boscop has joined #ocaml
<gildor>
(e.g. 100!)
edwin has joined #ocaml
zsparks has joined #ocaml
<thelema_>
gildor: true
<thelema_>
f[x]: findlib name or executable name is used as package name. If a package provides multiple findlib names, it's available under all of them
<thelema_>
ah, because without sudo, it assumes a local install.
Tobu has quit [Remote host closed the connection]
<thelema_>
that's easily fixable, now which way to fix it.
Tobu has joined #ocaml
<thelema_>
configurable --prefix? or auto-detect permissions for using default prefix...
<thelema_>
is it reasonable to assume default prefix is /usr/local/?
Cyanure has joined #ocaml
<f[x]>
why do you need to care about prefix?
<f[x]>
everybody _should_ install with ocamlfind
<thelema_>
because I need it to do a local install in my home dir on some systems
<thelema_>
and one of my test cases was oasis, which has lots of deps, some of which aren't findlib packages, but are programs
drunK has joined #ocaml
ankit9 has quit [Quit: Leaving]
<adrien>
I haven't followed the whole conversation but I like to be able to select different prefix: I currently have a godi toolchain in /opt/ocaml/ and one in ~/test and maybe a third one somewhere in my home
<f[x]>
I guess there is no good soultion for prefix for same program compiled with multiple ocaml versions
<thelema_>
well, if it's a program, it shouldn't matter which ocaml version it's compiled with
philtor has joined #ocaml
<thelema_>
adrien: TODO noted
ulfdoz has joined #ocaml
<adrien>
and I'd like to do automated testing of everything on a variety of different environment, so that'd help :P
<adrien>
anyway, be back later
<f[x]>
probably
<thelema_>
adrien: I'm making the prefix thing happen now
<adrien>
oh, great :-)
<thelema_>
f[x]: and I'm making the "don't sudo and don't use --prefix" now too
<thelema_>
--have-perms
<thelema_>
adrien: I assume you want OCAMLFIND_DESTDIR repointed with a different --prefix?
<f[x]>
better OCAMLFIND_CONF and PATH
<thelema_>
f[x]: thanks, that is better
<f[x]>
(but then again I would argue that it is probably out of scope of odb)
<thelema_>
if a small tweak increases the scope of odb, I don't mind. If it's not so simple and rarely used, it doesn't go in
gnuvince|work has joined #ocaml
ygrek has joined #ocaml
<gnuvince|work>
What is the "usual" build tool for OCaml projects?
<thelema_>
hmm, maybe `OCAMLFIND_CONF=... ocaml odb.ml --have-perms foo` is better than adding prefix support
<gnuvince|work>
I've seen OCamlBuild, OMake, OASIS, etc.
<gnuvince|work>
Lots of choices
<f[x]>
thelema_, that's what I wanted to say :)
<gildor>
gnuvince|work: OASIS is not really a build tool, it is mostly a wrapper around ocamlbuild
<thelema_>
gnuvince|work: Oasis isn't exactly a build system, it'll generate a build system for you (assuming you can describe the build system to it)
<thelema_>
gnuvince|work: the most common build tools are ocamlbuild and make
<gnuvince|work>
Plain old make?
* f[x]
has a simple utility to select ocaml environment via these variables, all other tools seem to work ok with such setup
<thelema_>
gnuvince|work: well, there's a nice ocamlmake file that you can include to improve usability of plain old make
<gildor>
gnuvince|work: I would choose ocamlbuild alone if you don't intend to distribute your project or oasis if you intend to distribute it
* thelema_
agrees with gildor
<gnuvince|work>
ok
<gnuvince|work>
I'll look into ocamlbuild
<gnuvince|work>
thanks
<gildor>
gnuvince|work: though, oasis can be nice for not public project since it ease some steps wrt to setting up ocamlbuild
kurtosis has quit [Remote host closed the connection]
<thelema_>
gnuvince|work: that said, I still use a simple makefile to run ocamlbuild, as typing `make` is easier than typing `ocamlbuild projectname.native`
<gildor>
(e.g. generates default myocamlbuild.ml and a lot of required stuff for ocambuild that you'll end up setting by yourself)
<gnuvince|work>
Great
<gildor>
gnuvince|work: and the Plugin: DevFiles in _oasis can generate a Makefile that call the right command
<gnuvince|work>
I don't really intend to publish this project
<gnuvince|work>
Just a small utility for some friends and myself.
<gnuvince|work>
I'll probably actually just give them the executable file
<zorun>
For a small project, I usually write a small Makefile that calls ocamlbuild
<avsm>
just download OCamlMakefile gnuvince|work
<avsm>
it takes about 5 seconds to configure, and you can get on with coding
<avsm>
for quick projects, thats what i use
<avsm>
when I'm feeling like a mental workout, I switch to ocamlbuild :)
ikaros has joined #ocaml
<thelema_>
f[x]: ok, new odb with --have-perms option to turn off both sudo and any --prefix stuff
<thelema_>
avsm: why is ocamlbuild a mental workout? because of _tags?
<avsm>
well, when something goes wrong debugging an ocamlbuild setup can take a lot of time
<avsm>
i just like that you define 4 variables (RESULT, SOURCES, PACKS, PREDS) and ocamlmakefile just works
<avsm>
having said that, I've ported Mirage to be fully ocamlbuild and it's lovely now. parallel builds are great.
barismetin has quit [Remote host closed the connection]
<gildor>
avsm: OCamlMakefile is great for very small projects, when you start digging a little bit in it, you can go through several stages of headache
<gildor>
avsm: esp. when something goes wrong
<gildor>
avsm: Makefile debugging can be a nightmare
<rproust>
imho ocamlbuild complexity/documentation ratio is way too high
zorun has quit [Read error: Connection reset by peer]
<avsm>
sure, but he wanted something small
<thelema_>
rproust: granted, but once you figure out enough (and use the right myocamlbuild.ml), building becomes pretty easy
zorun has joined #ocaml
<thelema_>
avsm: I often use ocamlbuild for single-file projects
<avsm>
darn, still no -pack support in ocamlbuild
ulfdoz_ has joined #ocaml
<rproust>
I'll eventually have to learn it… and then I'll be too lazy writing documentation/tutorial, and I'll watch other complain, and I'll sparsly distribute tips on request
<avsm>
that sinking feeling of going through the changelog with increasing eagerness, and then falling off the end :)
<avsm>
rproust: ha ha, yes… writing a tutorial on it is "on my list" too
<avsm>
sorry, -pack support in ocamldoc i meant, not ocamlbuild
<thelema_>
avsm: huh? batteries (pre 1.0) used packs extensively and did... ah
<thelema_>
yup, looks like that'll call A#sendOtherPck B#list_pck for every pair of distinct A & B
<Tommytom>
just if B#need_send_update == true
<thelema_>
ues.
<thelema_>
*yes
<Tommytom>
Is it correct: let list_clients = ref [];; ?
<thelema_>
the ocaml toplevel can give you an answer to that easily:
<zorun>
from a functional point of view, this is bad style, but it is perfectly valid :)
<thelema_>
$ ocaml
<thelema_>
# let list_clients = ref [];;
<thelema_>
val list_clients : '_a list Batteries.ref = {contents = []}
<Tommytom>
damned, I have a probleme somewhere
<thelema_>
(ignore the bit about batteries)
<thelema_>
zorun: I've seen worse first steps into functional programming
<Tommytom>
I used to program in C and C#, it's difficult CamL :p
<Tommytom>
*i'm used
munga has quit [Ping timeout: 260 seconds]
<thelema_>
keep working at it - learning ocaml style takes some getting used to.
<Tommytom>
but I work on translation of one of mine program written in C#, not very easy to begin
<zorun>
hum, translating a program from one style to another is a bit similar to natural languages
<zorun>
that is, the litteral translation is often awkward
<thelema_>
OCaml is surprisingly flexible when it comes to many programming idioms, although there's usually better ways to do things in OCaml than the literal conversion
<Tommytom>
Litteral to begin and optimization later
<thelema_>
not just in terms of performance, but in terms of program structure.
<Tommytom>
Yes of course
<Tommytom>
can you look this function and give me the prototype ?