<otk>
"Not only is the title question too broad, it's highly subjective (bordering on inflammatory). "
<otk>
as usual harrops comments are spot on
mcclurmc_ has quit [Read error: Connection reset by peer]
<djcoin>
What is the future of OCaml in "company" world given F# is a kind of clone with Micro$oft behind, pushing it potentially with its massive amount of money and engineers ? (do not want to troll or anything)
asdfhjkl has joined #ocaml
<gasche>
djcoin, no no-.NET language has future in the .NET world -- the choice, if it happens, will therefore mostly depend on the company choice to use .NET or not
<djcoin>
Indeed
<gasche>
otk, I think the people reacting in the comment were simply annoyed by the question and awkward formulation; this has been discussed a lot and people are simply bored, hence some overreaction; harrop is right in principle, but pointing to a previous discussion would have been even more constructive
ikaros has joined #ocaml
robthebob has joined #ocaml
<Ptival>
wow, I've been struggling trying to decipher this "otk" acronym before I realized it was someone's nick =__=
<djcoin>
:)
gasche has quit [Ping timeout: 260 seconds]
<milosn>
there is some mention on ocaml reddit of proper support for multithreading
<milosn>
is this just ... hot air :)?
gasche has joined #ocaml
g0dmoney- has joined #ocaml
Tobu has quit [Ping timeout: 260 seconds]
<Ptival>
milosn: I think thomasga publicly mentioned that it's currently being worked on at OCamlPro
<Ptival>
milosn: don't expect a due date though :)
<milosn>
cool
<milosn>
i am not, my ocaml is at noob level ... i am just looking for features which might make it worth investing more time
<milosn>
its some sort of ML family language for the JVM
<otk>
gasche: i see
<otk>
makes sense
<otk>
djcoin: if it helps, i am a hobbiest programmer and it seems like it is quite easy to interchange ocaml and F# code, i think .net has a lot of steam because of stuff like C#
<gasche>
well F# and OCaml have a common base, but diverge on the advanced features
<otk>
IMO, (prepares to be shot down) F# wont be a limelight language in terms of itself, but its experimentation and use will lead to better C# code.
<otk>
gasche: ya agree
<otk>
(i use only the basic stuff :))
<gasche>
that's good, simple code is good -- when you can express what you need.
<otk>
you already see Functional stuff getting into C#, lambda in LINQ ect
<otk>
i think Erik Meijer is the driving force behind much of that
KDr2 has joined #ocaml
<otk>
gasche: one thing i like in ocaml that i really miss in F# is that i believe the ocaml built in functions for performing operations on strings\integers\chars are better
<otk>
string_of_int is so much better than the 'string' function in F# which utilizes polymorphic parameters
<otk>
so you have some type inference stumblings
<otk>
and end up writing your own functions and specifying the type signature heh
<otk>
(or type annotations)
<gasche>
regarding F#/C#, the F# team is doing a very good job at improving the language in directions they're interested in (eg. type providers), which could have impact on the medium-long term. I mean the research is not just on the "integration into C#" side
<otk>
yeah thats true and valid
<otk>
im personally not seeing eye to eye with them on type providers yet though
<otk>
F# holds itself up
<otk>
but i doubt its going to take the world by storm
<otk>
oh yeh and also ocaml goes to native code
<otk>
thats probably what would attract me to ocaml for a project over F#
<thomasga>
(ocaml goes to javascript as well :-)
<otk>
ah F# does too!
<thomasga>
well, you need silverlight installed, don't you ?
<milosn>
djcoin: i dont see where is the need for ocaml in manupulating the html DOM :)
<otk>
i do! JS blows monkey dongs and ocaml is alright!
<milosn>
which is what most people use JS for
<otk>
yes but if you were forced to use JS, would you rather write JS or write ocaml that writes the JS
<djcoin>
To me JavaScript is one of the biggest goal OCaml must achieve
<djcoin>
Because the Web is huge, and web app are too
<djcoin>
The fact that OCaml seems close to javascript and has great AST Tools are a force that must be used
<milosn>
you will not get web monkeys, including myself, to write ocaml and compile that to JS :)
<djcoin>
I am myself an heavy js coder
<otk>
milosn: no but you will get elitist snobs who dont know JS coding ocaml that compiles to JS :P
<otk>
(ok im not an elitist snob but i certainly don't know JS)
<milosn>
i know enough JS to get by
<djcoin>
I find this very thrilling
<djcoin>
s/very//
<milosn>
i am sure its an exciting project and all that
<otk>
ive never had to code JS though
<djcoin>
Yup
<milosn>
but you will not get majority of web monkyes including myself to code ocaml when they want to insert a <p> into DOM :)
<djcoin>
Why is that ? What would you use, jquery ?
<milosn>
i do use jquery, yes
<djcoin>
Yep me too
<otk>
i think it isnt just the end product though, it is the learning in writing a compiler.
<otk>
fantastic way to learn both languages
Submarine has quit [Ping timeout: 245 seconds]
<otk>
and parsing and lexing
<djcoin>
:) Sure, to get through hundred of specification pages ? :)
<otk>
all the wonders of the world in the palm of your hand
<otk>
djcoin: you will come out a better man with the tools ready to insult people on the internet
<otk>
now... lets write a JS VM in ocaml hehe
<milosn>
hmmm its quite simple, you have to understand the dynamics of the web ... web apps are primarily developed by underskilled people, compared to anyone who would have an interest in ocaml and practice using it, and simply no company like ever will want to use ocaml as main development tool
<milosn>
they can employe and pay web monkeys, not people with phds :)
<otk>
good ser i have no phd! but i understand what you are saying
<djcoin>
otk: agreed
<otk>
we, pursuers of higher intellect are doomed to sit in our niche corner ;p
<milosn>
otk: yup, that more or less sums it up
<otk>
that and, have you ever had a battle with someone trying to argue python vs ocaml? heh
* milosn
makes python and php web apps
<milosn>
:)
<otk>
well you are in ocaml so its different
<otk>
lol
* djcoin
python and javascript (heavy client side app)
<gasche>
milosn, js_of_ocaml will be useful for specific case when you are glad to write your business logic in OCaml, rather than on the JS side
<gasche>
nobody claims that it should replace every piece of JS code on the planet
<gasche>
(for just the reasons you cite)
<otk>
will it help me write XSS for work
<otk>
heh
<djcoin>
In my opinion, one of the problem is _testing your client app_. It's a pain when you have several languages (+ you duplicate code=)
<flux>
wish there was a more machine-readable/machine-executable format for client-side applications than javascript though. and java (Bytecode) doesn't quite integrate as well to web pages as javascript.
<gasche>
flux, JS can be seen as just one awkward bytecode format
<otk>
gasche: haha +1
<gasche>
Brendan Eich is right in pointing out that "having a VM for the web" won't make most problems go away
<otk>
djcoin: im not familiar with the perils of real development :)
<gasche>
(and I'm not sure that generating, say, JVM bytecode is more comfortable than JS)
<flux>
gasche, at least it's less silly
<otk>
MS are also putting $$ into JS stuff i hear
<gasche>
well
<djcoin>
Yep
<gasche>
at this point everything is kinda silly flux, so I go for the easier deployment with good-enough performances
<gasche>
JS is increasingly "good enough" and working on it; JVM may be better but is a pain to distribute on the web
<gasche>
(when I say "I go" it's in a rethorical sense, I don't code for the web, oh thanks)
<flux>
I think Java's biggest failure perhaps wasn't its startup time or distribution, but that it wasn't able to interact with web pages as well as javascript
<flux>
the other points could surely have been worked out.
<gasche>
in any case, when chosing a low-level backend, pragmatism is more important than aesthetics
<otk>
are we realy going to start the java failure talk
<otk>
i go to bed at night thinking about how to insult java
<gasche>
besides, what I usually don't like with backends is how crufty and ill-defined, ill-documented they are
<djcoin>
Don't be such a hater :)
<gasche>
it turns out people are working on formal definitions of (reasonable subsets of) JS -- and LLVM for that matter
<gasche>
so that issue may be less proeminent in the future
<otk>
java shouldn't be used by universities to teach compsci students algorithms, because they go into the real world thinking that is actually how it should be done. essentially planting the seed of corruption in young tangible minds
<otk>
thats pretty much my arg hehe
<djcoin>
For one, i'm hating about "Caml light" being replaced by Java in computer science students (university)
<djcoin>
For first years programming
<otk>
why do they do these things it makes me angry
<gasche>
well, using "Caml Light" today is alone a motive for hate
<djcoin>
Yep me too.
<djcoin>
What do you mean ?
<otk>
should be using SML for first year uni
<gasche>
Caml Light is essentially not maintained anymore
<gasche>
there is no point in using it rather than OCaml, besides some people having been lazy for ten years in a row
<djcoin>
Oh yeah, but it still be a good introduction to functionnal paradigm
<gasche>
OCaml would be just as well
<djcoin>
s/be/is/
<djcoin>
Sure
<gasche>
-- and they would stop using capitalized variable names...
<gasche>
plus OCaml has an ecosystem, better tooling, better editor support, etc etc etc.
<otk>
i wish i had picked up SML before F#
<otk>
but it is fairly ok going back and learning SML
<djcoin>
But thats not the point, they delete "introduction to functionnal paradigm". And introduce Java as first years course
<otk>
djcoin: ya that blows !
<gasche>
there is *no* reason to still be using Caml Light, and it just sucks to have to explain to the students "ah, if you want to do a real project during the summer, it's ok but you'll have to replace init_vect by Array.init etc etc."
<djcoin>
Whether they use Caml Light, or OCaml, or Haskell or whatever
<gasche>
of course, but a Caml Light rant seemed appropriate
<djcoin>
:)
<otk>
its strange to me, functional is so much more intuitive and easy to grasp
letrec has quit [Read error: Connection reset by peer]
<otk>
object oriented is a very complex and difficult paradigm
<otk>
object oriented java even more so
<otk>
the mind boggles
<djcoin>
I will make a mail about this to appropriate teachers in the college I'm speaking about
letrec has joined #ocaml
<otk>
good, someone needs to take a stance against the sperglord invasion
<djcoin>
otk: I'm not sure it is "this complex"
<otk>
i use the word complex here not in a computational sense but a groking sense
<gasche>
I believe implementation inheritance is "complex" for most reasonable meanings of the term
<gasche>
(ok, not algorithmic complexity)
<otk>
heh
<otk>
well, i think that much of the core of learning functional language concepts (and i am certainly no expert) is a really good continuation of highschool algebra
Kakadu has quit [Ping timeout: 260 seconds]
<otk>
(at least here)
<otk>
my first language was python and it was easy enough writting small scripts without any functions, but i never started to actually understand programming until i related it back to algebra in highschool
<otk>
im sure many many others have been in the same situation
<otk>
fortunately i didn't go to uni so i wasnt forced to learn java and co :) </endbio>
<djcoin>
I, for one, am not much into maths and algebra stuff. C pointers where enought to make me understand programming :)
<otk>
oposite for me, i was bad at maths except for algebra
<djcoin>
(Even if I can feel Algebra, types theory etc. are fundamental)
<otk>
i struggled with C stuff until this year i think
<otk>
kept putting it off because it seemed daunting
<otk>
but i live in windbg so it didn't take long i guess
<otk>
but imo f x = x * x is way easier to understand than pointer jujitsu
<otk>
and type inference helps reduce the noise and keep it closer to the algebra
Cyanure has quit [Remote host closed the connection]
Cyanure has joined #ocaml
<otk>
that being said, each to their own, all languages are interesting!, bedtime
MaskRay has joined #ocaml
MaskRay has quit [Changing host]
MaskRay has joined #ocaml
<djcoin>
bbye
gasche has quit [Ping timeout: 252 seconds]
avsm has joined #ocaml
gnuvince_ has joined #ocaml
Tobu has quit [Ping timeout: 272 seconds]
otk_ has joined #ocaml
Tobu has joined #ocaml
otk has quit [Ping timeout: 265 seconds]
ivan\ has quit [Ping timeout: 245 seconds]
ivan\ has joined #ocaml
<milosn>
otk_: if you aspire to be anything more then a web_code_monkey with prospects of becoming some middle_manager_monkey/team_leader ... maths is important :)
oriba has joined #ocaml
<Ptival>
if I have a tail-rec function unit -> unit (infinitely looping), which does "let str' = String.copy str; process str'; tailcall ()"
<Ptival>
will I leak all these strs?
<Ptival>
str's
<f[x]>
if process stores them in some reachable location
<Ptival>
that could only be a global?
<Ptival>
thing is: I do have a space leak, but I'm really not sure why
<Ptival>
could it be those Hashtables I'm input_valueing?
ulfdoz has joined #ocaml
<Ptival>
or maybe I wasn't leaking, I'll double-check
snearch has quit [Quit: Verlassend]
<milosn>
Ptival: paste the code :)
<milosn>
i know that in scheme tailcall optimized code doesnt "leak" :)
<flux>
ptival, do you have exception handling?
<milosn>
thats a good question, ocaml has tailcall optimization?
<flux>
ptival, actually if you have a relatively modern ocaml and its emacs mode, it can tell you which calls are tail-recursive and which not
<flux>
this unfortunately doesn't work for me, so I can't really tell which version you need to have :)
<Ptival>
I'm sure it's a tail call :)
<Ptival>
the leak seems subtle, it depends on my program's input
robthebob has quit [Quit: Leaving]
<Ptival>
it's some sort of ELF analyzer, that I'm fuzz-testing
<Ptival>
for some ELFs the test loop run in constant space
<Ptival>
but for a few of them, it eats up to gigabytes of memory
<Ptival>
dunno if I care enough...
KDr2 has quit [Remote host closed the connection]
ikaros has quit [Quit: Ex-Chat]
<Ptival>
it's weird
<Ptival>
reported memory usage jumps suddenly by 1 GB at some point
<Ptival>
I added a Gc.compact () in the loop, so it must actually be a leak
<adrien>
was it 500MB before?
<f[x]>
you can use objsize and observe which values grow
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
<adrien>
also, what are the values for both RES and VIRT?
<Ptival>
adrien: wait, I just restarted it
<Ptival>
it takes some time to jump
<Ptival>
there goes one of them: VIRT=2596M, RES=1767M, MEM%=22.2 (of 8GB)
<Ptival>
they usually begin at VIRT=18k, RES=5k, MEM=0.1%
<Ptival>
f[x]: how would I use objsize?
<f[x]>
as usual : start with README, then the mli file
g0dmoney- has quit [Changing host]
g0dmoney- has joined #ocaml
emmanuelux has joined #ocaml
<Ptival>
f[x]: what I mean is I don't know what value to look at
<Ptival>
my "loop top-level" scope is barely empty
<flux>
ptival, so basically each iteration of your loop starts from scratch, but it still leaks memory?
twittard has quit [Quit: twittard]
<flux>
ptival, and there are no mutable global variables that might grow?
<f[x]>
Ptival, check all global variables
<f[x]>
also there are some experimental patches for objsize to traverse the whole heap
<Zedrikov>
No there doesn't seem to be reordering, but I still miss the point in wanting to reorder things
<Zedrikov>
Just put them in the right order no?
<_habnabit>
have you never done localization of strings in your application?
<Zedrikov>
No
<Zedrikov>
What is the problem with localization?
andreypopp has quit [Quit: Computer has gone to sleep.]
andreypopp has joined #ocaml
<_habnabit>
like I said: if you have >1 value you're trying to format into a string, the order of the values can be language-dependent
twittard has quit [Quit: twittard]
<pippijn>
_habnabit: is it at all possible not to have literal format strings in ocaml?
<_habnabit>
pippijn, and do what instead?
<pippijn>
have named string objects as format strings
<thelema>
you can have format strings only as literals.
<pippijn>
right
<thelema>
If you need to construct a format string procedurally, it's possible in some cases, but very difficult to do in general because of the number and type of arguments
<pippijn>
so how are you going to do localisation, then?
<thelema>
ah, that's easy, as the type and order of the arguments are fixed.
<_habnabit>
well, no, that's the problem I have: the order isn't fixed
<thelema>
(although you need a feature of printf that was removed from previous ocaml because it was buggy)
<pippijn>
thelema: if you're french, the order is not fixed
<thelema>
Luckily I'm not french, so the order is fixed. :P
mcclurmc_ has joined #ocaml
<thelema>
hmm, I can't seem to find the bug in oasis that I remember about this.
<thelema>
fixed by removing positional specifiers from the doc (for the time being)
<_habnabit>
oh, haha
gnuvince_ has quit [Quit: Lost terminal]
twittard has joined #ocaml
twittard has quit [Read error: Connection reset by peer]
twittard has joined #ocaml
Submarine has quit [Quit: Leaving]
andreypopp has quit [Quit: Computer has gone to sleep.]
andreypopp has joined #ocaml
jamii has quit [Ping timeout: 276 seconds]
twittard has quit [Read error: Connection reset by peer]
Snark has quit [Quit: Quitte]
ikaros has quit [Quit: Ex-Chat]
Zedrikov has quit [Quit: Bye all, see you next time!]
andreypopp has quit [Quit: Computer has gone to sleep.]
andreypopp has joined #ocaml
pps has joined #ocaml
drewbert has joined #ocaml
<drewbert>
I have a function and for some reason ocaml thinks the return type is string, even though everywhere I look it appears to be a different, user-defined type that I want. Is there a way I can set the return type for a function so that I get better error information where I must be accidentally returning a string?
<adrien>
show the code :P
<adrien>
you can also add type annotations in order to make the error appear earlier in the code
<thelema>
drewbert: agreed on type annotations.
<drewbert>
I have type annotations on the inputs. Hold on and I'll pastebin the code. I'm really bad at ocaml. Don't make fun of me. ><
<thelema>
let rec tc_expr : prog -> (string * Ast.typ) list -> Ast.expr -> Ast.typ = fun p env -> function | EInt n -> ...
_andre has quit [Quit: leaving]
<thelema>
drewbert: it does look like it should return a Ast.typ, though.
<thelema>
style wise, please don't start lines with "in"; try to end lines with "in"
<drewbert>
thelema: Thank you so much!
<thelema>
drewbert: did that help?
<drewbert>
thelema: yes
<thelema>
ok, where's the error? I still don't see it.
<drewbert>
lca_class expects a string after EIf. I guess that was enough to coerce the whole function
<thelema>
ah, that was the first time the function was called recursively, so...
<drewbert>
The more I know!
<thelema>
so that's the first place it used to refine the return type
<drewbert>
Gotcha
<thelema>
Maybe it'd be more predictable and give better error messages if it used the type of the first matches...
<thelema>
but technically that only gives the type of the match expression, and it has to finish typing the match expression before it can link that back up with the type of the function
ftrvxmtrx has joined #ocaml
<drewbert>
Hrmmm. Well with the way you wrote the type annotations, it shouldn't be terrible to figure out. I'll have to remember that trick in the future.
ulfdoz has quit [Ping timeout: 260 seconds]
<thelema>
I prefer to annotate types directly on the function instead of on the arguments. It's possible to put a `: return_type ` after the argument list, IIRC as an alternative
<thelema>
# let f (x:int) : int = x + 1;;
<thelema>
val f : int -> int = <fun>
<drewbert>
I seeeeEEeee. Why do you prefer it the former?
lorilan has joined #ocaml
<lorilan>
Drakken, you mean guess ?
<thelema>
the type is clearer, and the extra () around arguments doesn't look so good.
alpounet has joined #ocaml
kmacy has quit [Quit: Leaving]
cdidd has quit [Remote host closed the connection]
lorilan has quit [Quit: Quitte]
lorilan has joined #ocaml
iago has joined #ocaml
djcoin has joined #ocaml
milosn has quit [Read error: No route to host]
pps has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
milosn has joined #ocaml
pango has quit [Remote host closed the connection]
pango has joined #ocaml
pango has quit [Remote host closed the connection]
pango has joined #ocaml
edwin has quit [Remote host closed the connection]
Xizor has quit [Ping timeout: 260 seconds]
Tobu has quit [Remote host closed the connection]
Tobu has joined #ocaml
cyphase has joined #ocaml
<_habnabit>
how do people debug C code that interfaces with ocaml? it seems like getting the actual value out of a `value` is a bunch of macros
<_habnabit>
(and, as such, gdb doesn't know about them.)
<lorilan>
printf
<_habnabit>
can't do that with a corefile
<lorilan>
then i don't know :(
<lorilan>
usually i'm fine with printf ^^
<_habnabit>
I'm talking about things like #define Double_val(v) (* (double *)(v))
<_habnabit>
and I still haven't figured out the right invocation to get the value of a bigarray
<lorilan>
what i've done the last time, is that i expansed the macro manually
<lorilan>
but i must admit, it's pretty tricky
<lorilan>
and at this hour i just can't do it
milosn has quit [Read error: Connection reset by peer]