<ctult_>
tac_: What I think OCaml is saying is that, all this time, in all these languages, mutability was just a crutch.
<ctult_>
in all the programs I made*
<tac_>
ctult_: it's even worse in Haskell :)
<tac_>
But yes, mutability is on a need-to-do-it basis.
<ctult_>
Sounds painful and unneccesary, but I am willing to give it a try.
rossberg has quit [Ping timeout: 252 seconds]
<tac_>
ctult_: It's a maintainability and scalability thing
<tac_>
ctult_: to make an analogy
<tac_>
You know about solid state drives versus traditional hard disks, right?
<ctult_>
tac_: mostly, yes
<tac_>
Traditional hard disks are high capacity storage. But they have moving parts.
tac has quit [Ping timeout: 245 seconds]
<tac_>
the fact there is a mechanical arm inside of them makes them more suseptible to breaking down
<tac_>
SSDs are more expensive, lower capacity disks, but there is no mechanical "moving parts"
<tac_>
so they are tougher to break :)
<tac_>
Side effects are moving parts
<ctult_>
I see.
<tac_>
(not the best analogy, but adequate I guess)
<tac_>
the problem with side effects are that they can potentially interfere with each other
<tac_>
and because very distant parts of code can communicate with them.
<tac_>
A global variable is a Bad Thing because any function might read or write to it. That means if there's a bug that has to do with that global, it could be absolutely anywhere in the program.
<tac_>
OOP dismisses the most obvious forms of global variables (save the "singleton pattern")
<ctult_>
(unlike Javascript) :)
<tac_>
hehe
<tac_>
yeah....
<tac_>
However, OOP focuses on each object maintaining its own internal state
<tac_>
and while "private" declarations help reduce the "globalness", you still have state being passed around
<tac_>
You have to be careful, for example, when threading. If I call foo.setValue("hello") in one thread, and call foo.setValue("world") in another concurrent thread, it's not obvious what the result will be :(
tac_ is now known as tac
<ctult_>
tac: So the way to avoid that is by passing everything through functions, rarely touching variables outside of those functions?
<tac>
basically
<tac>
When you have a "pure" function (one that performs no side effects) the only inputs you get are the arguments and the only outputs you're responsible for is the return value.
<tac>
If there's a bug in it, you only have to check the caller and the callee to find it.
<tac>
pure code is also threadsafe because it's referentially transparent
<ctult_>
tac: So instead of a big spaghetti-code mess like OOP can make, It's small elegant states in a larger machine, and those machines make up even larger machines?
<tac>
that is the ideal
<tac>
of course, ideals are just ideals :)
<tac>
But the static typing helps with that.
<tac>
You can start with messy, ugly code with side effects, and then go back and refactor those side effects away.
rossberg has joined #ocaml
<ctult_>
Iterative refinement at its best.
<tac>
Refactoring is just rewriting your code so it does the same thing, but it's easier to maintain.
<ctult_>
I think I'm starting to get it now. :D
<tac>
But static typing helps you catch a ton of bugs that would occur if you just did a blind refactoring.
<tac>
It might take you 20~30 minutes to sort out all the type errors, but when you finished, you could have a moderate feeling your code will work right
<ctult_>
So it also moves most of the bugs to syntax errors instead of runtime errors, which are exponentially more diffucult to fix?
<tac>
technically "type errors" but yeah :)
<tac>
Sometimes the type errors can be harder to fix because you can't see what your program does at all until it typechecks
<tac>
but
<tac>
it can catch bugs in every code path without you having to run through it all.
<tac>
I'm sure in JS, you have rewritten a function, it seems to work, you turn in your code at the end of the day, and then, you find out the next day that there was a typo or something stupid!
<ctult_>
lol all the time
<tac>
and you just didn't click the right button to catch it
<tac>
static typing stomps that shit out :)
<ctult_>
:D
<tac>
It's no an issue in JS, but in Python, if you do 'num cars ' + numCars
<tac>
you get an error if numCars is an integer
<tac>
You have to do 'num cars ' + str(numCars)
<tac>
and even though I've been doing python for a decade, I still do that to myself __all_the_time__
<ctult_>
Correct me if I'm wrong, but does that mean that ml will _help_ me with programming, instead of just providing an interface to the system?
<tac>
That's a matter of opinion, but I believe it helps :)
<tac>
Even if you just learn to program functionally, those lessons can carry over to other languages as well
<tac>
Knowing when a problem is better solved with recursion
<ctult_>
This is making me rethink my past 9 years, in a good way.
<tac>
Or having a feel for where side effects belong
<tac>
You also become very fond of making DSLs and writing evaluators
<tac>
That's actually a big part of how you factor out the side effects
<ctult_>
yay!
<tac>
instead of DOING the side effects you need to do, you DESCRIBE them.... in a data structure
<tac>
then you write an evaluator, which is a recursive function which walks over that data structure and does the side effects.
Yoric has quit [Remote host closed the connection]
Yoric has joined #ocaml
ttamttam has quit [Remote host closed the connection]
ttamttam has joined #ocaml
xenocons has joined #ocaml
gour has joined #ocaml
xenocons has quit [Ping timeout: 276 seconds]
gour has quit [Quit: WeeChat 0.4.0]
xenocons has joined #ocaml
anderse has joined #ocaml
xenocons has quit [Ping timeout: 248 seconds]
osa1 has joined #ocaml
Cyanure has joined #ocaml
xenocons has joined #ocaml
<orbitz>
Does a person need OASIS installed in order to compile something packaged with oasis?
xenocons has quit [Ping timeout: 240 seconds]
<adrien>
no
<orbitz>
is oasis the de-facto standard these days or just ocamlbuild or what?
<adrien>
oasis is a frontend to other build systems
<adrien>
currently there is only ocamlbuild as a supported backend
<adrien>
I've managed to do more with oasis than with ocamlbuild directly (becuase oasis creates an ocamlbuild plugin)
<adrien>
today, I'd advise people to use oasis
<adrien>
things I need to take a closer look at: ocp-build and obuild
<adrien>
ocp-build overlaps with oasis but not completely
Anarchos has joined #ocaml
leoncamel has joined #ocaml
<mcclurmc>
i'd definitely encourage people to give obuild (https://github.com/vincenthz/obuild) a try. it's very small, very fast, has no external dependencies, and has a nice cabal-like spec file syntax.
<Anarchos>
better than ocamlbuild ?
<adrien>
it's difficult to say better or worse than ocamlbuild
<adrien>
you have:
<adrien>
- ease of setup
<adrien>
- maintainability and modifications
<adrien>
- speed
<adrien>
- number of corner cases
<adrien>
couple things like that
<adrien>
ocamlbuild is very easy to setup and is fairly maintainable but has some corener cases that are fairly annoying and is fast enough
<adrien>
pick 2 :-)
leoncamel has quit [Ping timeout: 252 seconds]
* orbitz
liks makefiels still
<adrien>
they really don't fit ocaml
<orbitz>
how come?
<adrien>
you can do it but it gets much more complicated
xenocons has joined #ocaml
<adrien>
ocamlmakefile is 6k lines
<orbitz>
i havne't foudn it very complicated. ocaml's build style is very c-like, which matches makefiles
tane has quit [Quit: Verlassend]
<adrien>
or maybe only 2k
<orbitz>
ocamlmakefiel does a lot, my system is simpler
<adrien>
ok, 1.3k :P
<zorun>
having to sort out dependencies by hand is not so fun
<adrien>
yeah, but if you want full coverage, you need something pretty big and ugly
<orbitz>
what do yo umean by 'full coverage?
<adrien>
full coverage of the build steps
<adrien>
like being able to do cma, cmxa, cmxs, cmi, cmo, cma, build C libraries, ...
<orbitz>
i do all of that sans the C libraries :)
<adrien>
mll, mly
<adrien>
-custom or not
<orbitz>
I haven't used those yet
<adrien>
they aren't very difficult but cma isn't either
<adrien>
it's simply that things add up
<orbitz>
So i'll concede: my build system covers all of those cases that I care about, which is not full coverage
<adrien>
and parallel builds
<orbitz>
make does parallel builds
<adrien>
but does your makefile handle that well?
<orbitz>
mine do
<adrien>
the one in ocaml's sources doesn't :-)
<orbitz>
the only edge case i hit that is a problem that i don't have a solid solution for right now is if i reocmpile a dependency library
ontologiae has joined #ocaml
<adrien>
I'm quite interested in ocp-build but worried about NIH syndrome (especially because it has its own findlib stuff support currently)
<adrien>
that's difficult to handle
<Anarchos>
anyway i think that ocaml tools command line options tend to be bloated with the years
<orbitz>
ah
<adrien>
Anarchos: like with what?
<orbitz>
the main problem I'm hitting is every package I relase, the firstwave is people asking me to repackage it in ocamlbuild or oasis
<Anarchos>
adrien ocamlc --help ...
<adrien>
Anarchos: yeah but what?
xenocons has quit [Ping timeout: 252 seconds]
<adrien>
orbitz: oasis I can understand because it does many more things
<adrien>
configure, META file generation,...
<orbitz>
adrien: if my make file provides all of those things should people care? I'm not sure if i'm missing something by using my own system other than other people not wanting to contribute to the build
<adrien>
hard to tell
<adrien>
do you use ocamlfind for everything?
<orbitz>
yes
<adrien>
(finding dependencies and installing)
<Anarchos>
adrien too much options to do too much things , it is only my point of view
<orbitz>
i'm not handling installing right now, but I would use ocamlfind for that
<adrien>
I'd have to look at one of your lib (which I won't be able to do before a few dozen minutes)
<adrien>
ah, that's the big missing point then
<adrien>
Anarchos: but which options are superfluous to you?
<orbitz>
yeah most of my stuff is very beta right now
<adrien>
definitely not -c I guess
<orbitz>
adrien: I'll bring a lib up to spec and present it to you when you have some time
<adrien>
installing is actually something difficult to do with makefiles
<adrien>
if you want to do it right that is
<adrien>
because you need to install .cmx files
<orbitz>
what is hard about installing cmx files?
<adrien>
you need them all
<orbitz>
like pokemon?
<Anarchos>
adrien no i don't find them superfluous, only too numerous :)
<adrien>
exactly
<adrien>
Anarchos: ah, but I find almost all of them useful ;p
<adrien>
although -labels could disappear
<orbitz>
so far the first package i've done that someoen redid in ocamlbuild was actually not how i want the program strucutred, i'l have to see if i can get the sturcture I want out of it, the problem being I have $project/lib/$subprojects and they condensed it to $project/lib/$allcodehere
leoncamel has joined #ocaml
<Anarchos>
adrien i don't do ocaml so intensive than you then :)
<Anarchos>
nopervasives ? I know it is needed to cmpile ocaml itself but never had to use it
andreypopp has joined #ocaml
andreypopp has quit [Excess Flood]
andreypopp has joined #ocaml
andreypopp has quit [Excess Flood]
<adrien>
hmpf
andreypopp has joined #ocaml
andreypopp has quit [Excess Flood]
<adrien>
well, it proves -nopervasives is needed :-)
andreypopp has joined #ocaml
andreypopp has quit [Excess Flood]
<adrien>
hmpf, I really need some rest, I've been meaning to use +b, not +q or +o >><<
andreypopp has joined #ocaml
andreypopp has quit [Excess Flood]
anderse has quit [Quit: anderse]
ontologiae has quit [Ping timeout: 240 seconds]
leoncamel has quit [Ping timeout: 252 seconds]
q66 has joined #ocaml
ahokaomaeha has joined #ocaml
mye has joined #ocaml
gour has joined #ocaml
gour has quit [Quit: WeeChat 0.4.0]
tane has joined #ocaml
<Kakadu>
if I do `export AAA=XXXX` and than execute `ocaml` in bash, why I can't see AAA in the output of Unix.environment () ?
<orbitz>
Kakadu: I just didit locally, worked fine
<adrien>
Kakadu: it's not AAA
<adrien>
it's AAA=XXX
xenocons_ has joined #ocaml
<|jbrown|>
Kakadu: did you literally use the backticks?
<Kakadu>
thanks a lit
<Kakadu>
a lot
<Kakadu>
I have not `export` in my .bashrc :)
xenocons_ has quit [Ping timeout: 255 seconds]
<Anarchos>
to compile ocaml on my french locale i must type : LC_CTYPE=C make world
<Anarchos>
for example
<Anarchos>
cause there is a parse of some floats written "0.3" which is not the format of the french locale (it is written "0,3" in this one, with a comma)
gour has joined #ocaml
anderse has joined #ocaml
chambart has joined #ocaml
xenocons_ has joined #ocaml
xenocons_ has quit [Ping timeout: 276 seconds]
anderse has quit [Quit: anderse]
myx has joined #ocaml
xenocons_ has joined #ocaml
ontologiae has joined #ocaml
anderse has joined #ocaml
anderse has quit [Client Quit]
xenocons_ has quit [Ping timeout: 260 seconds]
xenocons_ has joined #ocaml
gour has quit [Quit: WeeChat 0.4.0]
xenocons_ has quit [Ping timeout: 248 seconds]
xenocons_ has joined #ocaml
xenocons_ has quit [Ping timeout: 256 seconds]
anderse has joined #ocaml
gour has joined #ocaml
cdidd has quit [Remote host closed the connection]
darinmorrison has joined #ocaml
gour has quit [Quit: WeeChat 0.4.0]
cdidd has joined #ocaml
gour has joined #ocaml
xenocons_ has joined #ocaml
xenocons_ has quit [Remote host closed the connection]
xenocons_ has quit [Remote host closed the connection]
Cyanure has joined #ocaml
chambart has quit [Ping timeout: 246 seconds]
xenocons_ has joined #ocaml
Yoric has joined #ocaml
darkf has quit [Quit: Leaving]
xenocons_ has quit [Ping timeout: 255 seconds]
xenocons_ has joined #ocaml
xenocons_ has quit [Ping timeout: 255 seconds]
ahokaomaeha has quit [Quit: When I come back, please tell me in what new ways you have decided to be completely wrong.]
ahokaomaeha has joined #ocaml
darinmorrison has quit []
axiles has joined #ocaml
<flux>
hmm, I've never had that problem although finnish locale also uses , as a decimal separator
mattrepl has joined #ocaml
xenocons_ has joined #ocaml
xenocons_ has quit [Ping timeout: 252 seconds]
<adrien>
it happens with some software
<adrien>
usually it's not a very good idea to have these settings to build software
<adrien>
manbut the issue is most certainly that LC_COLLATE is not set or wrongly set
<adrien>
that's the environment variable that sets how to do comparisons and conversions (blah this internet connection is lagging)
Armael has quit [Ping timeout: 260 seconds]
xenocons_ has joined #ocaml
Armael has joined #ocaml
sysop_fb has quit [Quit: Leaving]
sysop_fb has joined #ocaml
nimred has quit [Ping timeout: 260 seconds]
nimred has joined #ocaml
xenocons_ has quit [Ping timeout: 256 seconds]
nimred has quit [Ping timeout: 246 seconds]
thelema_ has quit [Remote host closed the connection]
karswell` has quit [Ping timeout: 255 seconds]
thelema has joined #ocaml
xenocons_ has joined #ocaml
gnuvince has quit [Ping timeout: 252 seconds]
Reventlov has joined #ocaml
yacks has quit [Ping timeout: 264 seconds]
ttamttam has quit [Remote host closed the connection]
xenocons_ has quit [Ping timeout: 256 seconds]
anderse has joined #ocaml
<ctult_>
Is there any sort of cross-platform OCaml graphics library?
xenocons_ has joined #ocaml
cross has joined #ocaml
xenocons_ has quit [Ping timeout: 240 seconds]
<Anarchos>
ctult_ gtk interfacing ?
Arsenik has joined #ocaml
<adrien>
lablgtk?
iZsh has quit [Quit: Coyote finally caught me]
iZsh has joined #ocaml
karswell has joined #ocaml
xenocons_ has joined #ocaml
xenocons_ has quit [Ping timeout: 255 seconds]
nimred has joined #ocaml
nimred has quit [Changing host]
nimred has joined #ocaml
ahokaomaeha has quit [Ping timeout: 276 seconds]
chambart has joined #ocaml
ahokaomaeha has joined #ocaml
UncleVasya has quit [Quit: UncleVasya]
Cyanure has quit [Read error: Connection reset by peer]
chambart has quit [Ping timeout: 246 seconds]
karswell has quit [Read error: Connection reset by peer]
caligula__ has joined #ocaml
anderse has quit [Quit: anderse]
caligula_ has quit [Ping timeout: 264 seconds]
karswell has joined #ocaml
travisbrady has joined #ocaml
cdidd has quit [Remote host closed the connection]
gour has left #ocaml []
travisbrady has quit [Quit: travisbrady]
travisbrady has joined #ocaml
myx has quit [Quit: ушёл]
ctult has joined #ocaml
ctult_ has quit [Read error: Connection reset by peer]
jknick has quit [Quit: Lost terminal]
gour has joined #ocaml
gour has left #ocaml []
mattrepl has quit [Quit: mattrepl]
osa1 has joined #ocaml
osa1 has quit [Client Quit]
munga has joined #ocaml
ahokaomaeha has quit [Quit: When I come back, please tell me in what new ways you have decided to be completely wrong.]
mattrepl has joined #ocaml
Snark has quit [Quit: Quitte]
gour has joined #ocaml
gour has left #ocaml []
emmanuelux has joined #ocaml
travisbrady has quit [Quit: travisbrady]
axiles has quit [Quit: Quitte]
<orbitz>
is it possible to write hex or octal values in a char literal?
<orbitz>
ah swell! nice
Arsenik has quit [Remote host closed the connection]
mattrepl has quit [Quit: mattrepl]
munga has quit [Quit: Ex-Chat]
travisbrady has joined #ocaml
<Anarchos>
orbitz yes it is
mye has quit [Quit: mye]
Yoric has quit [Ping timeout: 252 seconds]
tcsc has joined #ocaml
mattrepl has joined #ocaml
Anarchos has quit [Quit: Vision[0.9.7-H-090423]: i've been blurred!]
Skolem has joined #ocaml
<Skolem>
I have a program which is just this one line: let coef = Array.map int_of_string Sys.argv;; When I run it (./a.out 1 2 3) I get the error: Fatal error: exception Failure("int_of_string"). What am I doing wrong? I basically want to convert the strings in argv into an array of ints. if I replace Sys.argv with [|"1";"2";"3"|] it works fine.
ollehar has joined #ocaml
<ollehar>
anyone in here? need some help with compilation
<julm>
Skolem: "./a.out" is not a number :P
<Skolem>
ha! thanks.
<julm>
ollehar: just pastebin your code somewhere, explain your problem and be patient
<ollehar>
ok :)
<ollehar>
can I make ocamlopt complain if it doesn't find a lib in e.g. -I mylib
<ollehar>
?
<julm>
ollehar: are you using ocamlfind?
<ollehar>
yep
<ollehar>
however, ocamlfind cast ld: cannot find -lcryptokit
<ollehar>
so my installation of cryptokit must be damaged in some way
<ollehar>
that's why i'm also trying ocamlopt
<julm>
first, you can stick with ocamlfind and just add -verbose to see the exact invocation of ocamlopt it does
karswell has quit [Read error: Connection reset by peer]
<julm>
the -lcryptokit is here: /usr/lib/ocaml/cryptokit/libcryptokit.a
ahokaomaeha has joined #ocaml
<ollehar>
thanks
ctult_ has joined #ocaml
ctult has quit [Ping timeout: 276 seconds]
<ollehar>
this? gcc: error: /usr/lib/ocaml/lwt/lwt_chan.o: No such file or directory
<ollehar>
should use lwt.a instead?
<ollehar>
can't find lwt_chan on my system
<ollehar>
.o
<ollehar>
lwt_chan.o
<julm>
ollehar: % ar t /usr/lib/ocaml/lwt/lwt-unix.a | grep lwt_chan
<julm>
lwt_chan.o
<julm>
use -package lwt.unix
tcsc has quit [Quit: computer sleeping]
Skolem has quit [Ping timeout: 240 seconds]
<ollehar>
julm: thanks again
<ollehar>
julm: any idea what to use instead of bigarray.o, big_int.o, nat.o?
<julm>
ollehar: to do what? what's the problem with them?
ctult_ is now known as ctult
<ollehar>
julm: sorry, same error as above:
<ollehar>
gcc: error: /usr/lib/ocaml/bigarray.o: No such file or directory
<ollehar>
gcc: error: /usr/lib/ocaml/big_int.o: No such file or directory
<ollehar>
gcc: error: /usr/lib/ocaml/nat.o: No such file or directory
<ollehar>
gcc: error: /usr/lib/ocaml/int_misc.o: No such file or directory
<ollehar>
gcc: error: /usr/lib/ocaml/extlib/extString.o: No such file or directory
<ollehar>
gcc: error: /usr/lib/ocaml/extlib/enum.o: No such file or directory
<julm>
are you using -package bigarray?
<ollehar>
nope, using ocamlopt now
<julm>
without ocamlfind?
<ollehar>
yes, ocamlfind still stuck on crypkit
<ollehar>
*cryptokit
<julm>
you should fix that
<julm>
'cause not using ocamlfind is insane
<ollehar>
it's fixed!
<julm>
ocamlfind reads META files and thus know what flags to give to ocaml{c,opt}
<ollehar>
had two destinations of cryptokit, one lacked libcryptokit.a
<ollehar>
thanks for your help!
<julm>
yw
Skolem has joined #ocaml
gnuvince has joined #ocaml
<Skolem>
OK, I have a function like this: let evalpoly coefs:(int list) x:int = …;; I've declared the types of the arguments, now how do I declare that the whole thing returns int?
chambart has quit [Ping timeout: 246 seconds]
<Skolem>
Figured it out: let evalpoly (coefs:int list) (x:int):int =...