flux changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 4.01.0 http://bit.ly/1851A3R | http://www.ocaml.org | Public logs at http://tunes.org/~nef/logs/ocaml/
rand000 has quit [Quit: leaving]
tobiasBora has quit [Quit: Konversation terminated!]
wolfnn has quit [Ping timeout: 272 seconds]
jonludlam has quit [Remote host closed the connection]
mzie has quit [Quit: Page closed]
strobegen has joined #ocaml
julien_t has joined #ocaml
strobegen has quit [Quit: Leaving.]
NoNNaN has quit [Remote host closed the connection]
Arsenik has quit [Remote host closed the connection]
oriba has joined #ocaml
oriba has quit [Quit: oriba]
oriba has joined #ocaml
oriba has quit [Client Quit]
mfp has quit [Ping timeout: 246 seconds]
BitPuffin has quit [Ping timeout: 272 seconds]
Simn has quit [Read error: Connection reset by peer]
gnuvince has joined #ocaml
gnuvince has quit [Changing host]
gnuvince has joined #ocaml
julien_t has quit [Ping timeout: 246 seconds]
platypine has quit [Ping timeout: 245 seconds]
wagle has joined #ocaml
pango__ has joined #ocaml
pango_ has quit [Ping timeout: 245 seconds]
chambart has quit [Ping timeout: 252 seconds]
platypine has joined #ocaml
Drup has quit [Quit: Leaving.]
<whitequark> I wonder how good ocamlopt actually is, is there an overview of the optimizations it performs somewhere?
<whitequark> or just the source?
breakds has quit [Remote host closed the connection]
mcclurmc has joined #ocaml
talzeus has joined #ocaml
zxqdms has joined #ocaml
osa1_ has quit []
osa1 has joined #ocaml
strobegen has joined #ocaml
mcclurmc has quit [Quit: Leaving.]
gnuvince has quit [Ping timeout: 240 seconds]
kizzx2 has quit [Ping timeout: 272 seconds]
ygrek has joined #ocaml
kizzx2 has joined #ocaml
yacks has quit [Read error: Connection reset by peer]
shinnya has quit [Ping timeout: 246 seconds]
ygrek has quit [Ping timeout: 272 seconds]
xenocons has quit [Quit: leaving]
Kakadu has joined #ocaml
ggole has joined #ocaml
ygrek has joined #ocaml
ollehar has quit [Ping timeout: 272 seconds]
mfp has joined #ocaml
julien_t has joined #ocaml
ygrek_ has joined #ocaml
ygrek has quit [Ping timeout: 245 seconds]
platypine has quit [Ping timeout: 240 seconds]
<adrien> whitequark: it makes almost no optimization
<adrien> inlining
<adrien> the most particular thing it does is to emit "sane" asm
Simn has joined #ocaml
ulfdoz has joined #ocaml
ygrek_ has quit [Ping timeout: 240 seconds]
wolfnn has joined #ocaml
AltGr has joined #ocaml
<whitequark> adrien: I see.
<whitequark> I've been idly thinking whether Obj.magic inhibits optimizations by allowing the compiler to make less assumptions about the code.
<whitequark> Seems like there aren't any to begin with.
<adrien> well, the code that gets generated is already fairly good; it's difficult to improve it
<adrien> you can introduce bugs, regressions on other platforms, there's increased complexity in the compiler, ...
yezariaely has joined #ocaml
<adrien> if you compare GCC and OCaml, there are almost no incorrect code generation for the ocaml compiler
Snark has joined #ocaml
<mrvn> What is realy ugly is that gcc uses undefined behaviour to optimize instead of giving a warning or error. So if you have some small bug somewhere whole parts of your code suddenly just disapear.
<adrien> not in 4.9 :P
<mrvn> they reverted that?
<mrvn> 4.8 had it majorly.
<adrien> no, they give warnings
<adrien> there's something for that
<mrvn> is it on by default?
<adrien> which is one more reason to avoid having an old compiler for work =/
<mrvn> (or in -W -Wall?)
<adrien> I don't know
<whitequark> mrvn: that's not gcc, that's just about every C compiler--undefined behavior is explicitly present in the standard for the purpose of stronger optimization.
<adrien> I don't think it would be by default
<adrien> also, -Wall, -Wextra: -Wall includes -W
<mrvn> whitequark: char s[10]; for(int i = 0; i < 10; ++i) { ... do something important ... s[i+1] = s[i]; }
<mrvn> whitequark: gcc 4.8 will remove the whole loop silently.
<whitequark> unfortunately there is no way to statically prove that the C program doesn't invoke UB at runtime, so just about only way to reliably detect breakage is to use tools like ubsan.
<whitequark> mrvn: I know. that's legal.
<mrvn> whitequark: it still totaly stupid
<mrvn> It obviously never ever what the user ment.
<adrien> well, if it took them only one minor release to move from that to emitting a warning, I'm fine
<mrvn> Imho that is an error.
<whitequark> mrvn: it is. the compiler really should emit a warning when the function does not have any defined behavior at all.
<adrien> it's also incorrect code that makes no sense
<whitequark> it can be very tricky to do in practice though.
<mrvn> whitequark: no. it is verry easy.
<mrvn> They already detected the undefined behaviour or they couldn't optimize it away. That was the hard part. It is trivial to give an error instead.
<whitequark> mrvn: using undefined behavior for optimization is, in general, completely legal and sometimes desirable.
<mrvn> whitequark: i never said it isn't legal. I said it is stupid.
<whitequark> as per why it's tricky, well, it's hard to generally produce a good error message.
<whitequark> it's easy to emit a warning like "this function always invokes UB", yes.
<adrien> the information needs to flow from the optimization passes to the user
<whitequark> the hard part is to explain to the user why exactly that happens.
<adrien> there's clearly work involved in doing so
<mrvn> whitequark: true. so start with being wague about it.
<jpdeplaix> gasche: hey, there is something for you on cumulus (in the comments) :)
<mrvn> whitequark: shouldn't be to hard to say "array out of bounce deteced in line xyz"
<mrvn> bounds even
<whitequark> mrvn: only if you keep that kind of high-level information in the IR
<whitequark> that is very expensive
<whitequark> clang's ubsan (which you need to turn on explicitly) does just that, and it catches all undefined behavior. gcc integrated it recently.
<mrvn> whitequark: they already do at least for some parts. For example the warning that a function doesn't return anything.
<whitequark> mrvn: that you can do with just the AST
<mrvn> whitequark: That only shows with -O2 since it needs the optimizing step to detect it,.
<whitequark> oh, I see.
<whitequark> I'm not that familiar with GCC's IR so I cannot say how that works. I only looked into llvm/clang's implementation.
<mrvn> anyway, all I'm saying is that it is stupid to just drop whole blocks of code just because one expression is undefined. Either give an error or hope it doesn't affect anything critical.
shinnya has joined #ocaml
<mrvn> the former obviously would be better
<whitequark> sure. this kind of bug also killed security-related checks in linux and chrome (pnacl), so it is pretty bad.
<whitequark> in both cases silently resulting in exploitable code
julien_t has quit [Ping timeout: 248 seconds]
<whitequark> I think UB is a design flaw in the language, but you have to work with what you have. *shrug*
<mrvn> some UB you can't get around without becoming insane. Like under/overflow.
<whitequark> turns out C's exploiting undefinedness of signed overflow in order to make tight loops faster by assuming they never roll over.
<whitequark> insane, indeed.
<mrvn> Plus on any still in use hardware the behaviour is well defined.
<mrvn> whitequark: for(short i = 0; i < 65535; i += 2) { }
<mrvn> whitequark: What is that supposed to do? catch the overflow and then end the loop?
<mrvn> s/65535/32767/
<whitequark> mrvn: um? what I mean is that the compiler can infer that the loop never rolls over, and that fact exposes more optimization opportunities for it.
<whitequark> I don't know for sure but I think e.g. vectorization would benefit from it.
<mrvn> more knowledge usualy gives better optimization
<whitequark> it's an incredibly perverse way of gathering that knowledge, though. originally that was meant to support non-2's-complement architectures, I think.
<mrvn> does the compiler even infere that? Doesn't it just say: 1) it doesn't overflow and we can optimize like this, or 2) it overflows and the behaviour is undefined so we can do whatever we want.
<whitequark> UB means "there's an invariant you cannot observe which results in no overflow". for your empty case there is clearly no such invariant so it breaks. if you take a non-trivial example,
<whitequark> e.g. replace the limit with a variable, this kind of analysis becomes more useful.
<whitequark> so if you do "i < x", it infers that x can never dynamically be 32767.
darkf has quit [Quit: Leaving]
BitPuffin has joined #ocaml
<whitequark> mrvn: let me in fact check if clang infers that.
ontologiae has joined #ocaml
<whitequark> mrvn: it does, if I remove sign-extension caused by integer promotion in the comparison.
zarul has quit [Ping timeout: 260 seconds]
ygrek has joined #ocaml
julien_t has joined #ocaml
chambart has joined #ocaml
ygrek has quit [Ping timeout: 245 seconds]
ulfdoz has quit [Ping timeout: 245 seconds]
ygrek has joined #ocaml
tane has joined #ocaml
ygrek has quit [Ping timeout: 260 seconds]
ontologiae has quit [Ping timeout: 272 seconds]
mort___ has joined #ocaml
bainikolaus has joined #ocaml
mort___ has quit [Quit: Leaving.]
bainikolaus has left #ocaml []
maufred has quit [Ping timeout: 272 seconds]
Arsenik has joined #ocaml
Sim_n has joined #ocaml
Simn has quit [Ping timeout: 252 seconds]
Simn has joined #ocaml
NoNNaN has joined #ocaml
Sim_n has quit [Ping timeout: 252 seconds]
pango__ has quit [Quit: Client exiting]
ulfdoz has joined #ocaml
zpe has joined #ocaml
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
mcclurmc has joined #ocaml
zpe has quit [Ping timeout: 260 seconds]
avsm has joined #ocaml
Anarchos has joined #ocaml
q66_ has joined #ocaml
q66 has quit [Disconnected by services]
q66_ is now known as q66
tane has quit [Quit: Verlassend]
cricri has joined #ocaml
avsm has quit [Quit: Leaving.]
zpe has joined #ocaml
ontologiae has joined #ocaml
shinnya has quit [Ping timeout: 260 seconds]
ontologiae has quit [Ping timeout: 272 seconds]
avsm has joined #ocaml
<thorsten`> how can i check the type of some ocaml-function if i have multiple ocaml-files depending each other?
<mrvn> each other? circular depends aren't allowed.
<mrvn> try ocamlc -i
ulfdoz has quit [Ping timeout: 272 seconds]
<thorsten`> i don't know if they are circular, but there are too many of them for a ocaml-beginner :D
<thorsten`> but ocamlc -i is exactly what i was looking for, thank you!
avsm has quit [Quit: Leaving.]
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
zpe has quit [Ping timeout: 240 seconds]
olibjerd has joined #ocaml
avsm has joined #ocaml
<adrien> did a quick experiment with yypkg
<adrien> it depends on sexplib which is a pack and therefore pulls the whole library all the time and it also pulls num and bigarray and ...
<adrien> so I copied the sources from sexplib, changing only what I needed to have it compile
<adrien> size before: 1718930 (non-stripped) and 1251848 (stripped)
<adrien> size after : 1252988 (non-stripped) and 907816 (stripped)
mort___ has joined #ocaml
avsm has quit [Ping timeout: 260 seconds]
zpe has joined #ocaml
jdoles has quit [Read error: Connection reset by peer]
cricri has quit [Remote host closed the connection]
tane has joined #ocaml
tane has quit [Client Quit]
tane has joined #ocaml
bholst has quit [Quit: No Ping reply in 180 seconds.]
bholst has joined #ocaml
jdoles has joined #ocaml
Drup has joined #ocaml
cricri has joined #ocaml
mort___ has quit [Quit: Leaving.]
Drup has quit [Remote host closed the connection]
Drup has joined #ocaml
ollehar has joined #ocaml
ygrek has joined #ocaml
pango has joined #ocaml
julien_t has quit [Ping timeout: 272 seconds]
mort___ has joined #ocaml
Drup has quit [Quit: Leaving.]
Drup1 has joined #ocaml
Drup1 is now known as Drup
<adrien> how can I add an arbitrary command-line option to the compiler using ocamlbuild's tags?
<Drup> you can't.
<adrien> ah, -cflag on the command-line should do it
<Drup> (yes, that sucks.)
<jpdeplaix> yes you can
<jpdeplaix> with a parametrize tag
<Drup> jpdeplaix: there is no such tag bydefault, isn't it ?
<jpdeplaix> nope, but you can write one.
julien_t has joined #ocaml
<jpdeplaix> let () = pflag [] "commandline" (fun x -> Sh x)
<jpdeplaix> I think it should work
<adrien> I'm going to see what I can do with that, thanks
<adrien> -compact doesn't save a lot of space :P
<adrien> I did a quick try with a shell script to be called instead of ocamlopt
<Drup> adrien: ahah, I asked myselft the same question when I wanted to try this option =)
<companion_cube> -inline 42
strobegen has quit [Quit: Leaving.]
<adrien> -inline 0 and -compact save only a few KB but my example is small and pervasives hasn't been built with them
<adrien> s/with/using/
paolooo has joined #ocaml
<Anarchos> companion_cube whyy 42 ?
<companion_cube> whyy not?
<adrien> and -nodynlink reduces the size too
<adrien> but overall this saves 2, maybe 3% of the size
paolooo has quit [Quit: Page closed]
mort___ has quit [Quit: Leaving.]
ontologiae has joined #ocaml
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
zpe has quit [Ping timeout: 272 seconds]
ollehar has quit [Ping timeout: 245 seconds]
ontologiae has quit [Quit: WeeChat 0.4.0]
ollehar has joined #ocaml
manud has quit [Read error: Connection reset by peer]
manud has joined #ocaml
mort___ has joined #ocaml
tianon has quit [Read error: Operation timed out]
tianon has joined #ocaml
maurer has quit [Ping timeout: 272 seconds]
maurer has joined #ocaml
julien_t has quit [Ping timeout: 246 seconds]
zpe has joined #ocaml
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
zpe has quit [Read error: Connection reset by peer]
zpe has joined #ocaml
Kakadu has quit []
mcclurmc has quit [Quit: Leaving.]
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
zpe has quit [Ping timeout: 260 seconds]
tane has quit [Quit: Verlassend]
tane has joined #ocaml
Snark has quit [Quit: leaving]
ygrek has quit [Ping timeout: 245 seconds]
zarul has joined #ocaml
brainacid has joined #ocaml
<brainacid> Hye all
* brainacid is stargne
<brainacid> n e 1 alive in here channel ppl??
<Drup> sure, ask your question :)
Anarchos has quit [Quit: Vision[0.9.7-H-280704]: i've been blurred!]
<brainacid> Hello Drup
<brainacid> Is OCaml pretty good language ? I like the functional paradigm
<Ptival> "pretty good" is not a thing
<brainacid> Is OCaml language suitable for a beginner ?
zpe has joined #ocaml
<flux> I think it has features that make it good for a beginner. such as: simple programs don't need ceremony.
<flux> some argue that dynamic typing is better for beginners.
<brainacid> Thanks flux
<Drup> flux: according to my little experience, those are the same that say "static typing is worthless, the one in Java keep getting in your way"
<flux> I think there is some value in getting errors where the problem occurs, compared to an obscure type inference error?
<brainacid> I enjoy both type systems
<brainacid> static and dynamic....different flavors of ice cream in the same shop
<brainacid> as long as the codee can solve its problem the rest is sprikles
<brainacid> *sprinkles
zpe has quit [Ping timeout: 272 seconds]
darkf has joined #ocaml
<brainacid> concatenating a string
<brainacid> let func x y = print_string x^y;;
<brainacid> ???
<adrien> you need parens
<brainacid> let funcstr (x y) = print_string x ^ y;;
<Drup> not there :)
<mrvn> let func x y = print_string (x^y);;
<brainacid> oops
<brainacid> can I do this
<brainacid> print_string (x^" "^y) ?
<brainacid> or \s space special char
<adrien> you can do it
<Drup> brainacid: try it, you will see.
<brainacid> yup
<brainacid> I am
<brainacid> got the toplevel open
julien_t has joined #ocaml
ulfdoz has joined #ocaml
cricri has quit [Remote host closed the connection]
<brainacid> hey
<brainacid> im trying to learn currying funtions
<brainacid> *functions
<brainacid> let funcstr x y =
<brainacid> print_string (x^" "^y);;
<brainacid> let funcadd x =
<brainacid> funcstr ("+");
<mrvn> nothing to learn, happens automatically
<brainacid> IM trying to use the first function in the second one but with no success
<brainacid> Write a function that takes two strings as an argument and concatenates them with a
<brainacid> space in between.
<brainacid> Now use currying with that function to define functions that append + and - to the end of the string,
<brainacid> again with a space in between.
<brainacid> thos are my exercises
<mrvn> brainacid: That exercise is wrong.
<brainacid> I know
<mrvn> you can only use currying to add to the front
<brainacid> Im trying to understand how to make it right
<mrvn> and you will keep failing because the exercise is wrong.
<brainacid> it says functions
<brainacid> so it wants 2 functions...one to add to the front of the string
<brainacid> one for the back
<brainacid> let funcadd x =
<brainacid> let y = funcstr ("+") in y;;
<mrvn> what is the x doing there?
<brainacid> im trying to funcadd "hello" and get "+ hello" using funcstr
<mrvn> don't you get a warning about unused variables?
<brainacid> let funcstr x y =
<brainacid> print_string (x^" "^y);;
<brainacid> let funcadd x =
<brainacid> funcstr ("+");;
<brainacid> funcadd "hi";;
<brainacid> - : string -> unit = <fun>
<mrvn> 21:37 <@mrvn> what is the x doing there?
<brainacid> x = hi
<brainacid> its the parameter for funcadd to take string
<mrvn> and you do nothing with it
<brainacid> and get it processed thru funcstr
<mrvn> nope, you aren't doing that
<brainacid> ok
<brainacid> can u nudge me
<mrvn> delete the x
mort___ has quit [Quit: Leaving.]
<brainacid> funcadd "hi";;
<brainacid> + hi- : unit = ()
<brainacid> mrvn, thanks
AltGr has left #ocaml []
ggole has quit []
<brainacid> how can I append to the end of a string?
<brainacid> im stuck
<mrvn> not with currying
<brainacid> thats ok without currying
<mrvn> you pass "-" as second argument to funcstr
<brainacid> tried that
<brainacid> got error
<brainacid> let funcadd =
<brainacid> funcstr ("+" "-");
<mrvn> "+" is not a function, you can call it
<mrvn> functions are not called with the arguments in ()
<brainacid> im confused now
<brainacid> dude earlier said I needed ()
<brainacid> maybe I misunderstood
struktured has joined #ocaml
<mrvn> () capsulates an expression so the order of precedence doesn't screw up your code.
<brainacid> let funcadd =
<brainacid> funcstr "+" "-";;
<mrvn> like 5 * (1 + 2)
<brainacid> i see
<brainacid> but this is correct
<brainacid> print_string ("kfke"^"lol");;
<brainacid> i get error if I dont use the parentheses
<mrvn> and the () make sure the ^ gets evaluated first and the result passed to print_string
<Drup> print_string "kfke" ^"lol" is parse like : (print_string "kfke")^"lol"
<mrvn> without it would do: (print_string "kfke") ^ "lol"
<brainacid> i see
<brainacid> sorry Im boring u guys with this simple stuff
<brainacid> say I want a function that takes a string and adds a char in the front and end of it
ygrek has joined #ocaml
<brainacid> ex: funcx "hi" ;; "This" -:
rand000 has joined #ocaml
<mrvn> let foo s = "+"^s^"-"
<mrvn> but that wasn't the exercise I believe
<brainacid> oh ok
<brainacid> I made a function when I first started ocaml but I deleted the file... that would do it differently than that but its all good
<mrvn> simpler is: let foo = Printf.sprintf "+ %s -"
<brainacid> interesting
madroach has quit [Quit: leaving]
ygrek has quit [Remote host closed the connection]
ygrek has joined #ocaml
zpe has joined #ocaml
Anarchos has joined #ocaml
mort___ has joined #ocaml
madroach has joined #ocaml
_eko has left #ocaml []
madroach has quit [Ping timeout: 264 seconds]
brainacid has left #ocaml []
julien_t has quit [Remote host closed the connection]
<mrvn> can ocaml be build with -j4?
<adrien> yes
<adrien> >= 4.01.0
<mrvn> so that means no :(
<adrien> if it's for a clean build, you can do
<adrien> make -j4 || make -j4 || make
<Drup> "try !" "nope." "try harder !" "Nope." "Ok do whatever you want"
<mrvn> I'm building debs for Raspery PI with ocamlopt enabled.
<Drup> mrvn: mandatory xkcd comment : http://xkcd.com/303/ :]
Anarchos has quit [Quit: Vision[0.9.7-H-280704]: i've been blurred!]
<mrvn> step 1 done ... Building native compilers
Arsenik has quit [Remote host closed the connection]
Arsenik has joined #ocaml
jonludlam has joined #ocaml
zpe has quit [Remote host closed the connection]
Arsenik has quit [Remote host closed the connection]
zpe has joined #ocaml
<mrvn> make install ...
zpe has quit [Ping timeout: 272 seconds]
platypine has joined #ocaml
levi` has joined #ocaml
levi has quit [Ping timeout: 252 seconds]
yacks has joined #ocaml
struktured has quit [Read error: Connection reset by peer]
olibjerd has quit [Read error: Operation timed out]
<mrvn> buidling debs ...
BitPuffin has quit [Ping timeout: 245 seconds]
ygrek has quit [Ping timeout: 240 seconds]
zpe has joined #ocaml
mort___ has quit [Quit: Leaving.]
zpe has quit [Remote host closed the connection]
rand000 has quit [Quit: leaving]
zpe has joined #ocaml
zpe has quit [Ping timeout: 245 seconds]
w0rm_x has joined #ocaml
yezariaely has quit [Quit: Leaving.]
ulfdoz has quit [Ping timeout: 245 seconds]
<mrvn> my ocaml crashes. Sometime after it does sigsetjmp(). :(
<mrvn> It crashes in my programm code. Printf.printf seems to be too hard for my ocaml exokernel. let () = () runs fine. Have to fix that tomorrow.
<whitequark> exokernels! people still write them :)
<mrvn> sure. I want to run ocaml code diretly on arm devices.
<mrvn> n8
<whitequark> mrvn: I'd be interested to talk about that, later
<whitequark> night.
<Drup> mrvn: mirage is too big for arm devices ? :)
iZsh has quit [Ping timeout: 272 seconds]
iZsh has joined #ocaml
wolfnn has quit [Ping timeout: 272 seconds]
shinnya has joined #ocaml
zpe has joined #ocaml
zpe has quit [Ping timeout: 246 seconds]
steshaw has joined #ocaml
w0rm_x has left #ocaml []
Drup has quit [Quit: Leaving.]
Drup has joined #ocaml
NoNNaN has quit [Remote host closed the connection]
Drup has quit [Remote host closed the connection]
Drup has joined #ocaml
Drup has quit [Remote host closed the connection]
Drup has joined #ocaml
chambart has quit [Ping timeout: 252 seconds]
ocp has joined #ocaml
Drup has quit [Quit: Leaving.]