adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | Upcoming OCaml MOOC: https://huit.re/ocamlmooc | OCaml 4.03.0 release notes: http://ocaml.org/releases/4.03.html | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
johnelse has joined #ocaml
johnelse has quit [Ping timeout: 252 seconds]
SilverKey has quit [Quit: Halted.]
SilverKey has joined #ocaml
silver has quit [Quit: rakede]
kakadu has quit [Remote host closed the connection]
wtetzner has joined #ocaml
ygrek has quit [Quit: ygrek]
ollehar has quit [Ping timeout: 264 seconds]
wtetzner has quit [Remote host closed the connection]
ygrek has joined #ocaml
Algebr` has quit [Ping timeout: 265 seconds]
LiamGoodacre has quit [Ping timeout: 264 seconds]
ygrek has quit [Ping timeout: 276 seconds]
rgrinberg has joined #ocaml
lol-icon has quit [Quit: Dammit, Emacs.]
pyon has joined #ocaml
rgrinberg has quit [Ping timeout: 265 seconds]
ygrek has joined #ocaml
ygrek has quit [Ping timeout: 276 seconds]
SilverKey has quit [Quit: Cheerio!]
unbalancedparen has quit [Quit: WeeChat 1.5]
pierpa has quit [Ping timeout: 276 seconds]
rgrinberg has joined #ocaml
nicholasf has quit [Remote host closed the connection]
darkf has joined #ocaml
rgrinberg has quit [Ping timeout: 240 seconds]
nicholasf has joined #ocaml
MercurialAlchemi has joined #ocaml
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
nicholasf has quit [Ping timeout: 244 seconds]
MercurialAlchemi has quit [Ping timeout: 250 seconds]
sh0t has joined #ocaml
nicholasf has joined #ocaml
SilverKey has joined #ocaml
slash^ has joined #ocaml
johnelse has joined #ocaml
travula has joined #ocaml
johnelse has quit [Ping timeout: 276 seconds]
travula has quit [Ping timeout: 252 seconds]
sh0t has quit [Remote host closed the connection]
zpe has joined #ocaml
ollehar has joined #ocaml
ggole has joined #ocaml
zpe has quit [Ping timeout: 244 seconds]
nicholas_ has joined #ocaml
nicholasf has quit [Ping timeout: 260 seconds]
MercurialAlchemi has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 250 seconds]
tane has joined #ocaml
hay207 has joined #ocaml
johnelse has joined #ocaml
dexterph has joined #ocaml
johnelse has quit [Ping timeout: 244 seconds]
pc_ has joined #ocaml
<pc_> I tried to run "ocamlopt -unsafe <code.ml> " but bound-checking seems still on...?
<pc_> I am using 4.03.0
<pc_> could anybody help?
pc_ is now known as lalaalalalalla
<lalaalalalalla> How can I trun off array bound checking? is -unsafe working for ocaml 4.03?
nicholas_ has quit [Ping timeout: 250 seconds]
nicholasf has joined #ocaml
<ggole> Hmm. There's nothing in the changelog to suggest it should not work.
<lalaalalalalla> So I suppose it will work in future version? or I may have to downgrade to privous ones.
<lalaalalalalla> Oh , I see what you mean. So it is bug.
<adrien> you are strongly encouraged to use Array.unsafe_{get,set} instead of -unsafe
<adrien> that way you can do it in the only places that matter
<ggole> -unsafe seems to work fine on 4.03.0 for me
<ggole> How are you testing it?
<adrien> also, obviously, it doesn't apply to whatever has already been built
* ggole brb
ggole has quit []
Simn has joined #ocaml
ggole has joined #ocaml
<lalaalalalalla> I am actually just reading the blog where you can find the usage of -unsafe , https://ocaml.org/learn/tutorials/performance_and_profiling.html#Arrays
zpe has joined #ocaml
zpe has quit [Ping timeout: 240 seconds]
<flux> I guess -unsafe is an easy way to find out if using those unsafe functions are worth it in the first place
nicholasf has quit [Remote host closed the connection]
<adrien> you can also see it in the profiling
<adrien> iirc the bound checks appear there
nicholasf has joined #ocaml
<adrien> and since you should start with profiling anyway :)
<lalaalalalalla> @flux, I am very new to the language, did you mean we'd better not use unsafe at all? My intention is simply to follow through the tutorial and see what I can learn.
<adrien> unless your code is very array-intensive, it's unlikely you'll get much by removing array bound checks
<adrien> and from a safety perspective that means trading safety (out of bounds are reported as exceptions) for some performance
<adrien> not the kind of tradeoff that is typically done in ocaml (well, sometimes, yes, but usually people try hard to get better performance without trading safety)
<flux> lalaalalalalla, I think it's not worth using the unsafe features unless you can pin-point that they could bring noticeable performance benefits
<flux> I mean, would you rather have an exception or random memory corruption in your ocaml program?
<flux> most optimistic case is getting a segmentation fault, but that's not guaranteed at all
<flux> maybe if you're writing a matrix library or do image processing are the unsafe functions worth it
kakadu has joined #ocaml
<lalaalalalalla> I think I basically got the idea. So now I am just curious maybe the tutorial article is outdated? or there is something different than I did for the simple -unsafe usage mentioned in the article.
pierpa has joined #ocaml
<lalaalalalalla> the test is simply to compile the following line with "ocamlopt -unsafe" -- "let a = Array.make 10 0.0
<lalaalalalalla> for i = 0 to 9 do a.(i) <- float_of_int i; done;;
<flux> so how do yo determine if -unsafe is not in effect?
<flux> if you want to find it out, you could just change the upper bound of the loop from 9 to 10
<flux> with -unsafe it will not raise an exception
<lalaalalalalla> oh right, it told me Error : Unbound module array. and generated nothing.
<ggole> ...
<flux> so I guess it fails same way with or withot -unsafe?-)
<lalaalalalalla> yes, failed in both ways.
<flux> seems like you have written array.make in your actual source code, not Array.make
Algebr` has joined #ocaml
<flux> hmm, or not
<flux> if Array.make doesn't work, your compiler installation is somehow broken
<lalaalalalalla> I double checked. it is Array instead of array.
orbifx1 has joined #ocaml
<flux> all in all, the problem is completely unrelated to -unsafe :)
<lalaalalalalla> Is there any other way to test it?
<ggole> You'll need a working program first.
<lalaalalalalla> I installed ocaml by using opam-installer.sh then opam swith 4.03 on archlinux.
octachron has joined #ocaml
<flux> did you also do eval $(opam config env) after that?
<lalaalalalalla> I can compile other simple code so far. for example just the binary tree on the ocaml website main page.
<lalaalalalalla> yes and I have been using this version for several weeks.
<flux> so if you start ocaml shell, what does #show Array;; do?
<octachron> lalaalalalalla, is your test file called array?
<lalaalalalalla> Error: Unbound value show.
<ggole> Include the #.
<ggole> That is, #show and not show.
<lalaalalalalla> well. @ggole, it outputs a lot things...
<flux> well, it seems the Array module exists fine in your ocaml then.
<ggole> That's the Array module
<flux> so if you put this into foo.ml: let _ = Array.make 10
<flux> and then ocamlopt foo.ml
<flux> does it give you an error?
<lalaalalalalla> @octachron, I rename my array.ml to test.ml and now it is working with -unsafe flag on.
<flux> the key is that your module name (Array) is conflicting with the existing system module Array
<lalaalalalalla> haha, I did not know this. really good to know. Thanks all of you!
octachron has quit [Quit: Leaving]
<flux> happy hacking :)
lalaalalalalla has left #ocaml [#ocaml]
Nahra has quit [Quit: ERC (IRC client for Emacs 24.5.1)]
zpe has joined #ocaml
zpe has quit [Ping timeout: 240 seconds]
<Algebr`> bucklescript for the future!
johnelse has joined #ocaml
johnelse has quit [Ping timeout: 240 seconds]
Nahra has joined #ocaml
<jstolarek> how do I load a source file into utop?
<Algebr`> #use
<Algebr`> #use "foo.ml";;
<jstolarek> thanks
<ggole> #mod_use is also useful
silver has joined #ocaml
<jstolarek> where can I find the list of all commands available in utop?
<jstolarek> a list with description of each command that is
<Algebr`> jstolarek: like the builtin ones using #?
<Algebr`> as a first approx, you could do # and then tab
<jstolarek> Algebr`: but that does not give me any description of what each command does
tristero has quit [Quit: tristero]
<jstolarek> for example, what is the difference between #mod and #use_mod ?
<Algebr`> yes, good point. I don't remember where's the docs for it. Probably check on github README for utop?
<ggole> The standard ones are listed in the manual: http://caml.inria.fr/pub/docs/manual-ocaml/toplevel.html#sec272
<ggole> I believe utop supports all of those.
<ggole> Oh, #help might be, uh, helpful
<Algebr`> thought utop printed that too at the beginning of each session
<jstolarek> ah, #help is nice
<jstolarek> I was only aware of #utop_help, as this is what gets printined when the session is started
<Algebr`> ah
zpe has joined #ocaml
<jstolarek> real world ocaml uses a "with" construct that looks like this:
<jstolarek> However, I get compilation errors
<jstolarek> has this syntax changed?
<kakadu> very likely
<jstolarek> I am using Ocaml 4.03
<kakadu> do you use utop?
<jstolarek> yes
<kakadu> https://github.com/janestreet/ppx_sexp_conv/issues/1 there are some useful commands there
<kakadu> Ah, top message describe what you should type in utop
<kakadu> describes*
<kakadu> jstolarek: There were some changes in syntax extension mechanism. Guys are working on improved edition of RWO
<jstolarek> right
* jstolarek has the printed version but was hoping that the online version is being updated when needed
zpe has quit [Ping timeout: 240 seconds]
<Algebr`> jstolarek: yep, that's camlp4 syntax. RWO second edition has been worked on for several years now.
pierpa has quit [Ping timeout: 240 seconds]
<jstolarek> heh.... #require "ppx_sexp_conv";; crashes utop :-)
<Algebr`> crashes meaning seg fault?
<jstolarek> No
<jstolarek> Fatal error: exception Exit
<kakadu> I use plain `rlwrap ocaml` instead of utop
<jstolarek> kakadu: RWO uses utop by default, so I assume the examples should somehow work with utop :-)
<jstolarek> Algebr`: what do you mean by "severel years"? The book is less than three years old...
<kakadu> jstolarek: they should work with plain toplevel too. It willbe not so fancy looking but they will work
<jstolarek> but of course if the language has changed since then it would be nice to get an updated edition
<Algebr`> jstolarek: a second edition was being worked on basically 2 years ago already
<kakadu> jstolarek: It will be great If you describe what you thinking about maintainers and obsolete examples in the mail-list
<kakadu> maybe new release will appear faster
<jstolarek> kakadu: I believe that the authors are well aware that some examples have gone out of date without my help ;-)
<jstolarek> and guess what, #require "ppx_sexp_conv";; crashes ocaml interpreter as well
<jstolarek> uncaugt exception, again
sdothum has joined #ocaml
<jstolarek> plus a fairly long stack trace
<kakadu> it works for me
<kakadu> do you use system ocaml?
<jstolarek> Algebr`: that sounds really nice. I wish Real World Haskell would get an update since it is nearly a decade old and completely out of date
<kakadu> or manually compiled using `opam switch 4.03.0`?
<jstolarek> um... I use ocaml installed with opam
<jstolarek> manually compiled
<Algebr`> yea, to be fair, real world haskell is way more out of date than real world ocaml
<kakadu> gimme stacktrace
<Algebr`> jstolarek: also silly but check opam switch as well, check if any warning printed
<kakadu> yes, `opam switch` output too
<lpaste> jstolarek pasted “ocaml crash stacktrace” at http://lpaste.net/173112
<jstolarek> kakadu: here the trace
<kakadu> the problemin in your ~/.ocamlinit
<Algebr`> yea ocamlinit
<kakadu> it mentions some camlp4 stuff
<kakadu> wipe it out
<lpaste> jstolarek annotated “ocaml crash stacktrace” with “ocaml crash stacktrace (annotation)” at http://lpaste.net/173112#a173113
<jstolarek> ok, lemme try
<jstolarek> right, so my .ocamlinit says #ocamlp4o;;
<jstolarek> I believe this was recomended in RWO - I wouldn't come up with this by myself :-)
<jstolarek> ah, works!
<jstolarek> I mean utop no longer crashes
<jstolarek> still gives me syntax errors when saying
<jstolarek> type some_type = int * string list with sexp;;
<jstolarek> even with all the incantations linked by kakadu
<kakadu> nonono
<kakadu> read the link from github
<kakadu> 1st message
<kakadu> syntax has changes
<kakadu> changed*
<jstolarek> oh
<jstolarek> right. Now it works :-)
<jstolarek> thanks
larhat has joined #ocaml
kakadu has quit [Remote host closed the connection]
larhat has quit [Read error: Connection reset by peer]
larhat has joined #ocaml
nicholasf has quit [Remote host closed the connection]
orbifx1 has quit [Ping timeout: 244 seconds]
johnelse has joined #ocaml
johnelse has quit [Ping timeout: 252 seconds]
LiamGoodacre has joined #ocaml
rgrinberg has joined #ocaml
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
sdothum has joined #ocaml
fraggle_ has quit [Ping timeout: 260 seconds]
rgrinberg has quit [Ping timeout: 252 seconds]
Simn has quit [Ping timeout: 260 seconds]
zpe has joined #ocaml
zpe has quit [Ping timeout: 264 seconds]
eikke has joined #ocaml
maker has quit [Quit: = ""]
MercurialAlchemi has joined #ocaml
fraggle_ has joined #ocaml
Simn has joined #ocaml
maker has joined #ocaml
copy` has joined #ocaml
picolino has quit [Ping timeout: 276 seconds]
MercurialAlchemi has quit [Ping timeout: 258 seconds]
dhil has joined #ocaml
Algebr` has quit [Ping timeout: 250 seconds]
orbifx1 has joined #ocaml
picolino has joined #ocaml
picolino has quit [Ping timeout: 252 seconds]
picolino has joined #ocaml
picolino has quit [Ping timeout: 240 seconds]
zpe has joined #ocaml
zpe has quit [Ping timeout: 264 seconds]
Anarchos has joined #ocaml
johnelse has joined #ocaml
johnelse has quit [Ping timeout: 240 seconds]
MercurialAlchemi has joined #ocaml
mpenet has joined #ocaml
maker has quit [Quit: = ""]
mpenet has quit [Remote host closed the connection]
troydm has quit [Quit: What is hope? That all of your wishes and all of your dreams come true? (C) Rau Le Creuset]
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
sdothum has joined #ocaml
wtetzner has joined #ocaml
orbifx1 has quit [Ping timeout: 240 seconds]
troydm has joined #ocaml
orbifx1 has joined #ocaml
orbifx1 has quit [Ping timeout: 260 seconds]
sh0t has joined #ocaml
ollehar has quit [Quit: ollehar]
johnelse has joined #ocaml
pyon has quit [Quit: Dammit, Emacs!]
maker has joined #ocaml
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
shinnya has quit [Ping timeout: 260 seconds]
johnelse has quit [Ping timeout: 260 seconds]
kakadu has joined #ocaml
nichola__ has joined #ocaml
dhil has quit [Ping timeout: 264 seconds]
aphprentice has joined #ocaml
d0nn1e has joined #ocaml
d0nn1e has quit [Quit: ZNC - http://znc.in]
d0nn1e has joined #ocaml
slash^ has quit [Read error: Connection reset by peer]
silver has quit [Ping timeout: 258 seconds]
silver has joined #ocaml
nichola__ has quit [Remote host closed the connection]
nicholasf has joined #ocaml
rbocquet has joined #ocaml
nicholasf has quit [Remote host closed the connection]
pierpa has joined #ocaml
rbocquet has quit [Quit: WeeChat 1.0.1]
Simn has quit [Read error: Connection reset by peer]
strykerkkd has joined #ocaml
jave has quit [Quit: ZNC - http://znc.in]
jave has joined #ocaml
zpe has joined #ocaml
rbocquet has joined #ocaml
zpe has quit [Ping timeout: 264 seconds]
darkf has quit [Quit: Leaving]
dwwoelfel has joined #ocaml
Guest96814 has joined #ocaml
Guest96814 has quit [Client Quit]
edwin has quit [Quit: ZNC - http://znc.in]
tane has quit [Quit: Leaving]
edwin has joined #ocaml
orbifx1 has joined #ocaml
ggole has quit []
johnelse has joined #ocaml
johnelse has quit [Ping timeout: 244 seconds]
LiamGoodacre has quit [Quit: Leaving]
orbifx1 has quit [Ping timeout: 265 seconds]
pyon has joined #ocaml
dexterph has quit [Ping timeout: 276 seconds]
Intensity has quit [Ping timeout: 240 seconds]
Intensity has joined #ocaml
cross has quit [Ping timeout: 265 seconds]
MercurialAlchemi has quit [Ping timeout: 250 seconds]
Intensity has quit [Ping timeout: 240 seconds]
Intensity has joined #ocaml
zpe has joined #ocaml
nicholasf has joined #ocaml
kakadu has quit [Remote host closed the connection]
zpe has quit [Ping timeout: 258 seconds]
dwwoelfe_ has joined #ocaml
sh0t has quit [Ping timeout: 244 seconds]
dwwoelfel has quit [Ping timeout: 244 seconds]
silver has quit [Ping timeout: 244 seconds]
ollehar has joined #ocaml
<ollehar> an honest question: if I make a compiler that compiles down to malfunction, couldn't I just as well compile down to (a subset of) ocaml itself? what would the benefit be of using malfunction (or compiling down to an IR of ocaml instead of ocaml)?
<Drup> you don't have to bother with pleasing the typechecker
<Drup> depending on your language, that might be a really big gain
<ollehar> hm
silver has joined #ocaml
<Drup> also, while it might be true that for any code you may want to emit, there is a corresponding ocaml program, that program might be neither pleasant nor easy to find
<ollehar> well in my case, compiling statically typed php, I'm not sure.
sh0t has joined #ocaml
<ollehar> I guess I could just make a list of the correspondence.
<ollehar> php-to-ocaml transpiler ><
<ollehar> heh
d0nn1e has quit [Ping timeout: 244 seconds]
d0nn1e has joined #ocaml
ollehar has quit [Quit: ollehar]
strykerkkd has quit [Remote host closed the connection]
SilverKey has quit [Quit: Cheerio!]
tmtwd has joined #ocaml