adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml 4.02.2 announced http://ocaml.org/releases/4.02.html | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
<ollehar> no? too late, maybe ^^
claudiuc has quit [Remote host closed the connection]
ril is now known as ril[away]
ril[away] is now known as ril
<octachron> quite limited, but it makes sense for tensor product, since multipling high order tensor is problematic by itself
claudiuc has joined #ocaml
lobo has quit [Quit: leaving]
ely-se has quit [Quit: Leaving...]
<ollehar> escape analysis?
ygrek has quit [Ping timeout: 246 seconds]
AltGr has joined #ocaml
ygrek has joined #ocaml
mk270 has joined #ocaml
jao has quit [Ping timeout: 272 seconds]
toomucht_ has quit [Ping timeout: 246 seconds]
<Drup> that might interest you
<octachron> Impressive, I wasn't aware that the modular implicit branch was doing implicit functor application
<octachron> it seems enough to do even multiplication ... probably at the price of combinatoric explosion
<Drup> octachron: can't manage to make it work on a etherogenous list at this hour of the night, though.
ollehar has quit [Quit: ollehar]
toomuchtvrotsurb has joined #ocaml
<octachron> it looks doable/fun to try
kakadu has quit [Remote host closed the connection]
octachron has quit [Quit: Leaving]
igoroliveira has quit [Quit: Connection closed for inactivity]
tmtwd has quit [Ping timeout: 264 seconds]
mk270 has left #ocaml [#ocaml]
ygrek has quit [Remote host closed the connection]
ygrek has joined #ocaml
claudiuc has quit [Remote host closed the connection]
tmtwd has joined #ocaml
tmtwd has quit [Ping timeout: 244 seconds]
toomuchtvrotsurb has quit [Remote host closed the connection]
GeorgeHahn has quit [Read error: Connection reset by peer]
claudiuc has joined #ocaml
ygrek has quit [Ping timeout: 240 seconds]
claudiuc has quit [Ping timeout: 250 seconds]
swgillespie has joined #ocaml
swgillespie has quit [Remote host closed the connection]
psy_ has quit [Ping timeout: 246 seconds]
swgillespie has joined #ocaml
darkf has joined #ocaml
psy_ has joined #ocaml
MrScout has quit [Ping timeout: 244 seconds]
johnf has joined #ocaml
nicoo has quit [Ping timeout: 264 seconds]
SomeDamnBody has quit [Ping timeout: 244 seconds]
shinnya has quit [Ping timeout: 252 seconds]
grouzen has quit [Ping timeout: 272 seconds]
tmtwd has joined #ocaml
pyon is now known as dinasor
Kwhy_Not has joined #ocaml
ril is now known as ril[away]
slash^ has joined #ocaml
ril[away] is now known as ril
Bhavya has joined #ocaml
BhavyaM has joined #ocaml
Bhavya has quit [Client Quit]
BhavyaM is now known as BhavyaM_
BhavyaM_ is now known as BhavyaM
tmtwd has quit [Quit: Leaving]
AlexRussia has joined #ocaml
Kwhy_Not has quit [Quit: Textual IRC Client: www.textualapp.com]
sailorsw_ has joined #ocaml
tmtwd has joined #ocaml
sailorsw_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
toomuchtvrotsurb has joined #ocaml
toomuchtvrotsurb has quit [Ping timeout: 252 seconds]
bbc has quit [Ping timeout: 256 seconds]
cross has quit [Ping timeout: 264 seconds]
xaimus has quit [Ping timeout: 264 seconds]
sivoais has quit [Ping timeout: 264 seconds]
xaimus has joined #ocaml
cross has joined #ocaml
sivoais has joined #ocaml
chris2 has quit [Ping timeout: 246 seconds]
bbc has joined #ocaml
chris2 has joined #ocaml
sivoais has quit [Ping timeout: 245 seconds]
sivoais has joined #ocaml
slash^ has quit [Quit: Leaving.]
ril has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
slash^ has joined #ocaml
rwmjones has quit [Ping timeout: 252 seconds]
c74d has quit [Remote host closed the connection]
darius93 has quit [Ping timeout: 252 seconds]
rwmjones has joined #ocaml
cross has quit [Ping timeout: 246 seconds]
cross has joined #ocaml
c74d has joined #ocaml
darius93 has joined #ocaml
nicoo has joined #ocaml
slash^ has quit [Quit: Leaving.]
slash^ has joined #ocaml
MercurialAlchemi has joined #ocaml
SomeDamnBody has joined #ocaml
xificurC has joined #ocaml
BitPuffin|osx has quit [Ping timeout: 264 seconds]
sailorswift has joined #ocaml
LnL has joined #ocaml
SomeDamnBody has quit [Ping timeout: 246 seconds]
antkong has joined #ocaml
SomeDamnBody has joined #ocaml
tmtwd has quit [Quit: Leaving]
antkong has quit [Quit: antkong]
dinasor is now known as pyon
slash^ has quit [Read error: Connection reset by peer]
antkong has joined #ocaml
sailorswift has quit [Read error: Connection reset by peer]
sailorswift has joined #ocaml
ely-se has joined #ocaml
ollehar has joined #ocaml
kakadu has joined #ocaml
grouzen has joined #ocaml
octachron has joined #ocaml
<ollehar> is escape analysis difficult to implement and/or expensive to run?
<ely-se> the answer is probably: depends
<ollehar> hm
<ely-se> how good do you want it to be?
<ely-se> detecting unused variables is one instance which is trivial to implement
<ollehar> I want it to differ between variables that can be stored on the stack vs on the heap.
<ely-se> variables which are never returned, thrown, passed or sent to are also not very difficult
<ely-se> what's more difficult is doing it across functions
<ollehar> do you know if there already is an implementation in ocaml?
<ely-se> you should probably do it after inlining
<ollehar> oh, so it's later in the pipeline??
<ollehar> damn
<ollehar> I only have two stages right now: type-inferring and generating LLVM IR code.
<ely-se> You can write your own LLVM optimization pass
<ely-se> which does escape analysis and turns heap-allocated objects into stack-allocated ones if appropriate
<ollehar> hm
<ely-se> you can query lots of stuff about LLVM Values
<ely-se> for example there's functions that allow you to find all their usages
<ollehar> oh
<ely-se> Are you using the C++ API or the OCaml API?
<ollehar> ely-se: ocaml
<ely-se> I've never used that API so I can't say much :P
<ollehar> OK, well. :) It should be largely the same, shouldn't it?
<ely-se> I have no idea.
<ely-se> brb gonna take a shower
<ely-se> Maybe I'll do some more LLVM stuff this weekend.
ely-se has quit [Quit: Leaving...]
<ollehar> bye
yaewa has joined #ocaml
moei has quit [Ping timeout: 255 seconds]
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
SomeDamnBody has quit [Ping timeout: 265 seconds]
BhavyaM has quit [Quit: Quit the channel]
ely-se has joined #ocaml
ollehar has quit [Ping timeout: 265 seconds]
Haudegen has quit [Ping timeout: 245 seconds]
Haudegen has joined #ocaml
ely-se has quit [Quit: Leaving...]
ely-se has joined #ocaml
|jbrown| has joined #ocaml
octachron has quit [Ping timeout: 244 seconds]
rand000 has joined #ocaml
zpe has joined #ocaml
ely-se has quit [Quit: Leaving...]
native_killer has joined #ocaml
|jbrown| has quit [Ping timeout: 255 seconds]
deavid has quit [Ping timeout: 260 seconds]
mea-culpa has joined #ocaml
|jbrown| has joined #ocaml
jbrown has quit [Remote host closed the connection]
ely-se has joined #ocaml
lobo has joined #ocaml
native_killer has quit [Quit: Leaving]
deavid has joined #ocaml
AlexRussia has quit [Read error: Connection reset by peer]
martintrojer has quit [Read error: Connection reset by peer]
sailorswift has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
martintrojer has joined #ocaml
AlexRussia has joined #ocaml
nightuser has joined #ocaml
<MercurialAlchemi> Drup: hahahaha
<Drup> the back story with the contest is stupidly awesome
<nightuser> hi. i'm relatively new to ocaml (one term project written completely in ocaml) and i want to get some real experience with this lang. so, is there any oss projects in which i can contribute?
<Drup> probably, what's your usual interest ?
ollehar has joined #ocaml
<ollehar> letstack a = 10 in ... ?
<ollehar> stack allocation
<nightuser> Drup: well, my primary field is statistics, however i'm interested in something related to compilers/formal grammars/etc (and i'm reading dragon book at the moment).
<ollehar> how much faster would a program be if you do not collect any memory?
<Drup> It would be very fast until it's not fast at all.
<ollehar> Drup: yes :)
<ollehar> hm
zpe has quit [Remote host closed the connection]
<MercurialAlchemi> Drup: where is the backstory? I read the stuff about the words of power...
<MercurialAlchemi> thx
<ely-se> ollehar: depends on numerous factors.
<ely-se> ollehar: C# has that feature; "int* xs = stackalloc int[n];". It's rarely used though
<mrvn> ollehar: that would mean you can't pass a to any other function (in general)
<mrvn> ollehar: and then the compiler puts it in a register anyway
yomimono has joined #ocaml
<ollehar> ok
<mrvn> ollehar: The ocaml type system can't express wether arguments to a function will persist across calls or even escape a function.
mrm has joined #ocaml
<MercurialAlchemi> Drup: awesome
mrm has quit [Remote host closed the connection]
<ollehar> mrvn: what type system would you need for that?
<mrvn> ollehar: rust does it with linear typing I think
<ely-se> It's not worth the extra efford.
<ely-se> Just allocate it on the GC heap and be done with it.
<mrvn> ely-se: if you can avoid the GC that is a huge gain, esspecially in multicore.
<Drup> nightuser: it's a bit large :/
<ely-se> Isolate threads completely and use one GC per thread.
<Drup> nightuser: you can look a bit at awesome-ocaml and find things you are interested in
<mrvn> ely-se: doesn't work for half the problems
<mrvn> ely-se: and if you make a mistake there is blows up
<ely-se> ugh, subclassing Error is such a pain in JS
<mrvn> ely-se: does js_of_ocaml have those?
<ely-se> no idea
<ollehar> so swift uses refcount and java/c# gc... why is there no simple answer!
<ollehar> mrvn: can't you infer variable ownership? or if they escape?
<ollehar> "infer"
chris2 has quit [Ping timeout: 252 seconds]
QuanticPotato has joined #ocaml
yomimono has quit [Ping timeout: 245 seconds]
<ollehar> hum
<nightuser> Drup: thx, i'll look into it. anyway, my interests are not limited to those i've listed above, so something else will be fine too.
ggole has joined #ocaml
<ollehar> "Reference counting is not considered as serious garbage collection by computer scientists"
<ollehar> Seriously? :D
<ollehar> from ocaml.org still
chris2 has joined #ocaml
<ollehar> Why bash on "Java has bad GC" when is much faster than OCaml?
<ollehar> *it's
<nightuser> ollehar: well, java doesn't have bad gc. also, there is more than one gc is avaiable.
magistr has joined #ocaml
<ollehar> nightuser: I was just quoting the article on ocaml.org, "Unlike the Java GC, which gives GCs a bad name". Oh well.
<ggole> It used to be terrible.
<ggole> Then Sun (and Oracle) paid smart people to make it not terrible.
yomimono has joined #ocaml
<nightuser> ollehar: it maybe ralated to java 6 gc
<nightuser> afaik, in java 7 oracle has replaced default gc
<ollehar> ggole: ok ^^
<ollehar> nightuser: yeah
<MercurialAlchemi> Is Java's GC "much faster" than OCaml's?
<ggole> No, but it deals with things that OCaml's doesn't (like simultaneous threads).
<ggole> There's also slick things like Zing's pauseless collector
<ollehar> MercurialAlchemi: if you check the binary tree GC test I linked above, java completes in 7,5 sec, ocaml in 33.
<ollehar> php 9 min :)
<ollehar> and Rust is not faster than Java in this benchmark.
chris2 has quit [Ping timeout: 246 seconds]
<nightuser> which Rust version are they using?
<ollehar> don't know :P
<ollehar> wait, 1.2
<ollehar> but memory usage is waaay better in rust, 73 vs 401 kb
<nightuser> it doesn't have gc after all
<ollehar> yes
<nightuser> 1.2 has been released yesterday. and btw Rust isn't mature enough.
<ollehar> sure, sure
<ollehar> yesterday? they updated the benchmark fast ^^
<magistr> rust don't have guaranteed TCO
<ollehar> uh
<ggole> Hmm, one of those fast Java versions is threaded: the other isn't
<ollehar> what's tco, magistr
<ollehar> ggole: this is one core
<magistr> tail call optilizer
<MercurialAlchemi> well, I don't know, how much penalty would ocaml be paying for all these fork calls?
<magistr> optimization
Anarchos has joined #ocaml
gasche has joined #ocaml
<gasche> ollehar: note the alternative OCaml version that has laxer GC setting
<magistr> Rust is a functional language and it is not may in tail call
<gasche> it consumes twice as much memory as the default OCaml version (which itself consumed as much as the C version), but runs exactly as fast as the Rust version
<gasche> (and still that means twice less memory than the Java version)
<gasche> it looks like the JVM can recognize settings that allocate like crazy and is tuned by default to blow up the memory budget to preserve throughput (not necessarily a bad choice in server environments)
<magistr> and "Rust does not have the “C-style” for loop on purpose. Manually controlling each element of the loop is complicated and error prone, even for experienced C developers."
<gasche> but making claim about a language's GC being sensibly faster than another on these benchmarks seems difficult
<ollehar> gasche: ah right, I just thought it was wrong algorithm
<gasche> (not that I think the Java GC is bad; nowadays it is pretty good)
<ggole> Mmm. It could just be a difference between default sizes of young generations.
<MercurialAlchemi> it's fast, but it gobbles all your RAM and doesn't give it back
<ggole> Or it could be (partly) a real difference in quality of implementation: very hard to tell without more serious testing.
<ollehar> gasche: what's "laxer"?
<gasche> the alternative benchamrk sets heap increment at 10Mo
<ggole> The idea of microbenchmarks as reliable indicators of language performance is pretty fraught in any case.
<gasche> basically the alternative GC settings will essentially make the GC not attempt to collect anything until the end of the program, exactly like what Java seems to do
<gasche> (of course on longer-running programs with a less unrealistic workflow that would actually behave sensibly in the long run)
<ollehar> So OCaml can collect as fast as Rust with proper GC tuning... That's something.
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
<gasche> I don't think these numbers mean much
<ollehar> well, is there better ways to measure performance?
<ollehar> I think all the benchmarks combined give a pretty good hunch, still.
<ggole> Find real programs that show large amounts of time spent in the GC, and work towards improving those.
chris2 has joined #ocaml
<ollehar> And it's possible to group languages together in speed, like C/Java, OCaml/Haskell, PHP/Python/Perl etc
<ely-se> lol
<ollehar> Btw, since memory gets bigger faster than CPU:s get faster, these settings make sence?
<ollehar> ely-se: what? :)
zpe has joined #ocaml
<ggole> Tuning is more complicated than that: part of the performance effect has to do with caching
pyon is now known as dinasor
zpe has quit [Ping timeout: 272 seconds]
<ollehar> ggole: fewer collections gives fewer cache misses?
chris2 has quit [Ping timeout: 240 seconds]
<ggole> If that were the only factor, the young generation size could be increased for an obvious win, and everybody would have already done that long ago.
<ollehar> so no.
<ggole> Small young generations have an advantage in that allocations can be made into cached memory.
<ggole> But a disadvantage in that they do more work in other areas.
<ollehar> ggole: "allocations can be made into cached memory". I don't understand this.
dsheets has joined #ocaml
psy_ has quit [Ping timeout: 260 seconds]
<ggole> Say you collect a young generation that is (considerably) smaller that the largest cache on the machine.
<ggole> When you reset the bump pointer, it will be pointing into memory that is still in that cache.
<ggole> Walking the young generation during GC should also cache better, since it's all still fairly recently touched.
psy_ has joined #ocaml
<ggole> In short, there are some tradeoffs.
<ollehar> ok
<ollehar> pizza time, thanks for the info!
BhavyaM has joined #ocaml
chris2 has joined #ocaml
BitPuffin|osx has joined #ocaml
mrm has joined #ocaml
ely-se has quit [Quit: Leaving...]
ollehar1 has joined #ocaml
ollehar has quit [Ping timeout: 260 seconds]
BitPuffin|osx has quit [Ping timeout: 245 seconds]
<ollehar1> test
<ollehar1> can a gc be more optimal if pauses doesn't matter?
<ollehar1> e.g., PHP never has to be real-time.
madroach has quit [Read error: Connection reset by peer]
madroach has joined #ocaml
xificurC has quit [Ping timeout: 265 seconds]
<ggole> There is something of a tradeoff between throughput and latency
<ggole> eg, the JVMs have different GCs that are designed to favour one vs the other.
<magistr> php is most pretty language for real-time web applications :)
tmtwd has joined #ocaml
<magistr> such as long polling and websockets
<ollehar1> ggole: ah ok
<ollehar1> maybe I could just steal one of those. I only they were implemented in C...!
<magistr> ollehar1, https://github.com/reactphp/react Nuclear Reactor written in PHP
<magistr> Code
<magistr> Issues 50
<magistr> Pull requests 16
<magistr> Wiki
<magistr> Pulse
<magistr> Graphs
<magistr> HTTPS clone URL
<magistr> You can clone with
<magistr> or
<magistr> .
<magistr> Nuclear Reactor written in PHP
<ggole> GC implementations don't tend to be particularly stealable
<magistr> Code
<magistr> Issues 50
<magistr> Pull requests 16
<magistr> Wiki
<magistr> Pulse
<ollehar1> ban...?
<magistr> Graphs
<magistr> HTTPS clone URL
<magistr> You can clone with
<magistr> or
<magistr> .
<magistr> Nuclear Reactor written in PHP
<magistr> Code
<magistr> Issues 50
<magistr> Pull requests 16
<ggole> They make too many assumptions about heap layout, etc.
<magistr> Wiki
<magistr> Pulse
<magistr> Graphs
<magistr> HTTPS clone URL
<magistr> You can clone with
<magistr> or
<magistr> .
<magistr> Nuclear Reactor written in PHP
<ollehar1> ggole: could you please ban that dude?
<magistr> poh
<ggole> I don't have ops here.
<ollehar1> ok
<magistr> u may ban me
<magistr> i not need on answers on my questions by topic
<Drup> ping adrien adrien_znc ^
grouzen has quit [Ping timeout: 244 seconds]
<magistr> to learn the any functional programming language it is necessary to know algebraic structures, systems of algebra and other applications of the discrete mathematics
<flux> no.
<nightuser> hmm. does ocaml have some "todo" operator like `???` in Scala or `undefined` in Haskell?
<flux> failwith "TODO"
<nightuser> fine, thx
<magistr> aximatic set theory to understanding a type thory
<magistr> HoTT
<magistr> topology
<magistr> homology theory
<gasche> magistr: there are many theories that are related to functional programming, and it is scientifically interesting
<gasche> that does not mean you should learn them if you want to learn functional programming
<gasche> in particular, I think blog posts about the Yoneda Lemma are silly
<gasche> some people like the hype about Category Theory; but in practice it is essentially useless for programming (functional or not)
<gasche> (it *can* be used to guide interesting designs (and also horribly overkill designs), but so can meditation and swimming, and people don't feel encouraged to practice those when programming)
<magistr> functional language is not need for me, it is more interesting to learn math
<gasche> be my guest, learn math
yomimono has quit [Quit: Leaving]
<gasche> there is no need to spam an IRC channel with copy-pastes of github menus, though
<Enjolras> companion_cube: i had never realized how cool containers was. Thanks :)
<magistr> Cat theory is explain simple common things
<magistr> and CT is simple
<magistr> ZFC is most useful
<magistr> to understand
<gasche> I doubt it (useful for what?)
<magistr> to use it in to construct types for example
<magistr> project types in your programm is a main thing
<magistr> and write a signatures
<Enjolras> is it possible to specify _tags directly in oasis for convenience ? 've seen that there is a XOCamlbuildPluginTags, which is an alpha features, but it doesn't appear to work
<Enjolras> (the goal is to avoir commiting autogenerated contents in git)
ril has joined #ocaml
<magistr> and in Haskell Functor in category Hask is must be a Endefunctor, or I don't understand Cat theory
<magistr> or a own contexts must be forms a subcathegory...
zpe has joined #ocaml
<Drup> Enjolras: use the dynamic setup for dev
<Drup> Enjolras: XOCamlbuildPluginTags is for something different (namely: compiling myocamlbuild.ml with some tags)
<Drup> with the dynamic setup, the files are either tiny or non existent
ollehar1 has quit [Ping timeout: 240 seconds]
<magistr> class Functor f a a => Endofunctor f a
<Enjolras> Drup: Thanks. that's right, could use dynamic setup, but it wasn't working with my use_menhir. I might have made a mistake, i'll try again
<Drup> it works fine with menhir, what was the issue ?
<Drup> don't forget to let a little thing in your myocamlbuild and _tags
<Enjolras> a little thing ? the # OASIS START thing is required with dynamic setup too ?
<Drup> yes
<Enjolras> ok. That probably was the issue
<Enjolras> yes, it works, thanks
<magistr> and "for all" quantification it is a don't right way to organize existential types
AltGr has left #ocaml [#ocaml]
<magistr> fp is a learn and learn math..
cdidd_ is now known as cdidd
BitPuffin|osx has joined #ocaml
ollehar has joined #ocaml
<magistr> algebraic topology is interesting subject
contempt has quit [Ping timeout: 240 seconds]
contempt has joined #ocaml
octachron has joined #ocaml
<magistr> topology is not use only to solve partial differential equations
<magistr> it helps to construct theorems for example
Anarchos has joined #ocaml
tashjash has joined #ocaml
rand000 has quit [Quit: leaving]
zpe has quit [Remote host closed the connection]
ril has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
ely-se has joined #ocaml
zpe has joined #ocaml
antkong has quit [Quit: antkong]
tashjash has quit [Quit: Leaving]
grouzen has joined #ocaml
kakadu has quit [Remote host closed the connection]
octachron has quit [Quit: Leaving]
<magistr> russian pigs
<magistr> it has awful comunity
<magistr> and they generate awful code
<Anarchos> magistr could you explain ?
<magistr> Anarchos, dirty and ugly code
<Anarchos> magistr where ?
<magistr> Anarchos, in they projects
<magistr> Anarchos, and they hate each other
<Anarchos> magistr i am curious to read their code, to build my own opinion
<magistr> Anarchos, and they not a Humans
<magistr> Anarchos, it is a russian pigs
kakadu has joined #ocaml
ely-se has quit [Quit: Leaving...]
dinasor has quit [Quit: RAWR IM A DINASOR!!1 (brb)]
kakadu has quit [Remote host closed the connection]
<mrm> magistr: Are you talking about the community of algebraic topologists? :-P
<magistr> mrm, no only or a russain programmers
kakadu has joined #ocaml
<mrm> By the way, there are a handful of russian guys here, so be gentle ;-)
kakadu has quit [Client Quit]
<magistr> mrm, they must go on dick
<mrm> :-(
<mrm> magistr: I have a strong feeling that you are a russian yourself.
<magistr> it is implication
<mrm> A kind of russian that makes me feel ashamed of my nation.
<mrm> Are you drunk?
ely-se has joined #ocaml
<magistr> are u stupid?
<ely-se> No, I'm pretty smart.
<magistr> not u
<ely-se> Somebody who says "u" and asks people whether they are stupid is mildly amusing.
<Drup> Please don't feed the trolls. :)
<iZsh> someone should run the GC on this channel
kakadu has joined #ocaml
kakadu has quit [Remote host closed the connection]
<magistr> iZsh, ask them
nightuser has quit [Ping timeout: 240 seconds]
<magistr> iZsh, also, u know how works gc in ocaml?
<magistr> iZsh, mark and sweep?
<magistr> ocaml has not TCO with tail rec, when i tried it
<magistr> and it is a interesting compiler
<flux> magistr, ocaml most certainly has TCO, works in all call cases not just recursion
vanila has joined #ocaml
<vanila> hi
<magistr> flux, i tried it three years ago
<flux> well, it had it then
<flux> nowadays you can also get editor feedback indicating whether your call is in tail position or not
<magistr> and any functional language has TCO
<flux> well, not true. Common Lisp doesn't have it.
<vanila> I always found that strange, what is the benifit of not having it?
<magistr> i don't know Common Lisp...
<flux> well, in Java it is/was probably some security related, Python's excuse is that it messes up with the stack traces
<magistr> i try to find normal documentation on it
<magistr> I read HyperSpec :)
<ggole> Many CL compilers provide it anyway.
<magistr> must be
<flux> I suppose using the optimization is OK if you know your implementation will always support it
<flux> but it is a feature the language must have in order for you to rely on it
<flux> of course, it's nice that it brings lower overhead, but TCO is something that can transfer a program that east all memory and crashes into a program that works
<ggole> There are some optimisations that TCO disallows, though
ollehar has quit [Ping timeout: 245 seconds]
QuanticPotato has quit [Ping timeout: 256 seconds]
<magistr> flux, why u use CL?
AlexRussia has quit [Read error: Connection reset by peer]
<ely-se> Does OCaml have downcasts?
<flux> I don't use CL
<flux> ely-se, no
<ely-se> cool
<vanila> ggole, really what ones?
<magistr> php is more difficult in use than your fp
darkf has quit [Ping timeout: 244 seconds]
<ggole> Stack allocation of anything passed to the tail-callee
bobry has joined #ocaml
ygrek has joined #ocaml
badkins has joined #ocaml
hefner has joined #ocaml
<ely-se> I'm not sure how to unit test my code generator.
<vanila> does it generate assembly code?
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
<ely-se> No, it generates bytecode for a custom instruction set.
nightuser has joined #ocaml
<vanila> do you have an interpreter for it? maybe that could be useful for the unit testing
<ely-se> Yup, a VM.
<vanila> so you could try something like have an intpreter i1 for the input language & i2 for t he vm language
<ely-se> I could make the test generate random programs of which it knows the output, then invoke the VM with those programs and observe the output.
<vanila> then i1 e == compile (i2 e) is a good test
<dmbaturin> ely-se: I'm not sure if unit testing in its original sense is applicable to code generators.
yomimono has joined #ocaml
<vanila> you can random tests but I would make a long list of "interesting" tests
<vanila> e.g. things that you know triggered bugs in the code-gen in the past
<ely-se> But the VM is also work-in-progress so it might not be correct.
<vanila> that way you can be sure you don't reintroduce the bug
<dmbaturin> ely-se: However, you can probably run predefined programs through it and then export the state of the abstract machine and compare e.g. register contents.
<vanila> that's ok that it might not be correct: there are only tests - not proofs
<dmbaturin> (If it's a register machine, of course, if not, then something else that is representative :)
Anarchos has joined #ocaml
<ely-se> It's a stack machine, but there's a breakpoint instruction (which is also used in the VM tests).
<ggole> Generating test programs is a bit tricky, though
ygrek has quit [Ping timeout: 256 seconds]
<ely-se> The VM tests resume threads until breakpoints are hit, then observe the call stacks and evaluation stacks.
<ely-se> I could write a little tool to export the state to JSON file.
QuanticPotato has joined #ocaml
<vanila> anything you can check for equality
<ely-se> Although that's still fragile.
<flux> ely-se, write valid but tricky programs that return 1 on success?
<ely-se> The VM may do various modifications to the code itself, and it also has internal instructions that aren't part of the public instruction set.
<flux> or some other predetermined value
<ely-se> flux: yeah, that's probably better.
yomimono has quit [Ping timeout: 240 seconds]
slash^ has joined #ocaml
<ggole> Equality is very tricky
<ggole> As soon as you introduce optimisations you run into serious trouble trying to say when two machine states are equivalent
<ely-se> I think I will write lots of sample programs that test various aspects of the language along with their expected outcomes.
<ely-se> Then run the entire toolchain on those programs.
<ely-se> Like end-to-end tests.
nightuser has quit [Read error: Connection reset by peer]
yomimono has joined #ocaml
<ggole> Another reasonable way to find bugs is to assert the hell out of everything and run a lot of (possible randomly generated) input through it
<ggole> You don't have to worry about equality doing that.
<flux> I think it might be quite difficult to write correct assertions for optimizations?
<dmbaturin> However, since register and memory layout may also change without effect on the execution... Maybe making the programs store the final result at specific address and comparing only reasonable option.
<flux> though there are probably places to use asserts as well
<ggole> There are usually some invariants you can look for.
<flux> basically optimization destroys a fragment of code and then creates new one to do the same thing but faster.. how do you assert that?
<ely-se> You run it and check whether the output is the same.
nightuser has joined #ocaml
<ely-se> It's impossible to compare arbitrary programs for equality since that would require solving the halting problem.
<flux> yes, but that happens in the test driver, not within the optimizer
<ely-se> (the language is Turing-complete)
<Drup> ely-se: do like in the compiler
<Drup> write a small program, it's output, execute program and diff with the expected output
<ely-se> Yeah, I had that in mind.
<vanila> you don't need to compare programs just the values they produce when run
<ely-se> Which now I think of it is exactly what I did with my other compiler. XD
<ggole> If you are generating the programs, you don't necessarily know the correct output
<ggole> Although that isn't a problem for differential testing.
<vanila> are these open source btw?
<dmbaturin> What if some optimization creates a situation when some state becomes incorrect after the test program output a value?
<vanila> i want to learn abuot compilers
<magistr> vanila, dragon book
<dmbaturin> I.e. it's correct for that example, but in a larger program it wouldn't be correct.
<ely-se> The dragon book is the most boring book I've read.
<ggole> Also, "running a program" doesn't tell you whether a translation is correct
<magistr> it is good book on compilers
<ggole> Only whether it is correct for that given input
<dmbaturin> If you want someone to never start writing compilers, give them the dragon book. ;)
<ggole> And it's really easy to miss the edge cases
<ggole> I don't think there's any easy answer to the problem.
<vanila> "test cannot prove the absence of bugs"
<dmbaturin> It's probably better to avoid optimizations whose correctness you can't prove.
<ely-se> Some tests can.
<vanila> yeah thats true ^^
<ely-se> But they're equivalent to proof by exhaustion.
<vanila> but in general its not to prove
<vanila> so situations like " state becomes incorrect after the test program output"
<dmbaturin> Besides, verified optimizations should make good conference papers. ;)
<vanila> it's a shame, it can happen
<vanila> but it's okay
<ely-se> A lot of information is luckily available at runtime, so I can test lots of properties.
<Drup> the issue with the dragon book is that it's not really that valid anymore
systmkor has quit [Quit: Leaving]
<ely-se> Types are fully reified which is needed because otherwise downcasts must be either unsafe or limited.
<Drup> it doesn't say much about modern optimisation technique and how you would design a compiler nowadays
<ggole> A first compiler should probably be pretty simple anyway.
<ggole> Otherwise you'll drown no matter the text.
<vanila> I've been studying register allocation for a few weeks
<vanila> but I couldn't find any really satisfying algorithms, it's very disheartening
<vanila> maybe im too much of a perfectionist
<ely-se> Your first compiler should probably be one for a dynamically typed language.
<ggole> Allocation is an annoying problem (if you are anal about code quality).
<ely-se> It's much easier to implement.
<ggole> All of the textbook algorithms are way oversimplified (without being particularly easy to implement).
<Drup> ely-se: is it ?
<Drup> I don't really find so
<vanila> I'm really anal yeah, I accept that we need heuristics (because a lot of problems are NP hard) but even then there are still warts in every method ive learned about
<ely-se> Yes; you don't have to implement a type checking algorithm.
<Drup> simple type checking is very simple
<ggole> I think ssa tree scan is probably the most promising
<ggole> Although I haven't done an implementation yet
<Drup> (it gros complicated quite quickly, I agree)
<ely-se> Which reminds me
<ely-se> I should refactor my type checker; it's a mess: https://github.com/mill-lang/millc/blob/master/lib/millc/type.ex
<vanila> I was very keen on the SSA => chordal graph stuff, but x86 requires a precolored graph.. and precoloring breaks a lot of required invariants
<ely-se> so much duplication and ugly code
<Anarchos> Drup and the bit array technique to store the type is just ugly in the dragon book...
ygrek has joined #ocaml
<ggole> The SSA regalloc stuff should work with precolored regs, but it will not be "optimal"
<magistr> read gcc
<magistr> i interesting how realized class on C
<ely-se> lol, don't read the source of a C++ compiler
yomimono has quit [Ping timeout: 272 seconds]
<magistr> why?
<Drup> ely-se: llvm is fine
<ely-se> because C++ may very well be the most complex programming language ever
<Anarchos> ely-se and the less error prone...
<ely-se> Yes, but LLVM isn't a C++ compiler.
<Drup> fair enough
<ely-se> :P
<ggole> I tried to understand reload.c, once.
yomimono has joined #ocaml
<ggole> Two pots of coffee in it was clearly not going to happen.
<ely-se> Fun-fact: to parse C++, you must be able to execute C++ code that tests primality of numbers.
<ggole> (That was before they tried to clean it up, perhaps things are a bit better now.)
<ely-se> Which can these days imply interpreting imperative code, since you can call some functions at compile-time now.
<Anarchos> ely-se the syntax correct if a number is prime is clearly a temptative to implement brainfuck at a meta-template level :)
sailorswift has joined #ocaml
<ely-se> Why brainfuck?
yomimono has quit [Ping timeout: 250 seconds]
<ely-se> Why not a ray-tracer? https://code.google.com/p/metatrace/
contempt has quit [Ping timeout: 256 seconds]
<ely-se> Also fun, analog literals: http://www.eelis.net/C++/analogliterals.xhtml
contempt has joined #ocaml
<ggole> I did that in Lisp - it was very easy.
<ggole> But of course Lisp is cheating. :)
<ggole> (Since the whole language is available at compile time.)
<ely-se> -1 not in the type system
<Drup> ggole: I can spin that in Idris or Agda too, but that's lightly unfair. :]
<Drup> slightly*
slash^ has quit [Read error: Connection reset by peer]
<ely-se> In D it's also easy.
<ely-se> You can call arbitrary functions at compile-time, and they can then return strings of D source code which you can then mix in at the call-site.
<Drup> ely-se: but in Idris and Agda, it *is* in the type system :D
ollehar has joined #ocaml
ygrek has quit [Ping timeout: 245 seconds]
<magistr> D ? use c plus plus
hbar has quit [Quit: WeeChat 0.4.2]
xificurC has joined #ocaml
nightuser has quit [Ping timeout: 240 seconds]
<ely-se> Alright, wrote a test runner for end-to-end tests: https://github.com/mill-lang/test
<Drup> you made a ruby executable that ouputs python code to test ocaml code ?
<ely-se> Oh crap, it doesn't check the actual output.
<Drup> you do realize it's 3 lines of make ?
nightuser has joined #ocaml
ggole has quit []
<ely-se> No, it isn't?
<ely-se> the program has to be compiled first, along with the libraries it depends on, and then passed to the VM
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
<magistr> a lot of russian fp programmers
<magistr> a lot of dirty pigs
<Drup> ely-se: for micro tests, the program doesn't depends on any library :p
<ely-se> My test programs depend on at least the text and log libraries, because otherwise they can't produce output :v
Anarchos has joined #ocaml
<ely-se> well, they depend on log, which in turn depends on text
<magistr> ocaml is ugly that have mutable terms
<magistr> they must be immutable
<magistr> it is not pure functional language
<magistr> ATD and pattern matching
<magistr> let rec is not optimize
jao has joined #ocaml
<ollehar> adrien_
<magistr> what functional language not support TCO
<magistr> Ocaml
ollehar has left #ocaml [#ocaml]
<magistr> it is nonsense
<magistr> and it is very great reason to use Rust
<vanila> mrvn, please ban this fucking retard
<magistr> retards are people who use Ocaml
<dsheets> we need more mods
<Drup> dsheets: yes we do
<dsheets> who has the bits to make more mods and why are they so stingy?
QuanticPotato has quit [Remote host closed the connection]
<magistr> rewrite Ocaml :)
<magistr> stdlib
<Anarchos> ely-se can we see your wonderful itnerpreter ?
<magistr> normal peoples uses haskell
<dsheets> siberian trolls make no sense
<dsheets> or maybe trolls who bounce through siberia
<Anarchos> ely-se oh javascript used there ?
<magistr> realy ocaml is dead
<ely-se> Yep. I'm writing a VM in JS because JS has only one threads.
<ely-se> Yep. I'm writing a VM in JS because JS has only one thread. *
<magistr> threads
<magistr> js
<Drup> ely-se: not sure why that's your constraint
<ely-se> Which constraint?
<dsheets> js has zero-copy actors in workers
<magistr> async
<ely-se> Workers are expensive.
<magistr> collbacks
<ely-se> They're intended for parallelism, really. I'm not interested in parallelism.
<magistr> fork and exec
<magistr> .child()
<ely-se> It's just that every time you write a callback or change your API to return Future<T> instead of T, a kitten dies.
<ely-se> I don't want implementation details like "does async I/O" to leak into my interface.
zpe has quit [Remote host closed the connection]
<magistr> node.js need framework such as OTP in erlang
<magistr> and ocaml - green threads? yep
<magistr> hot code upgrade? :)
Pricey has joined #ocaml
nightuser has quit [Ping timeout: 272 seconds]
<magistr> dead language
<magistr> java 8 better than ocaml
xificurC has quit [Ping timeout: 246 seconds]
LnL has quit [Ping timeout: 260 seconds]
nightuser has joined #ocaml
zpe has joined #ocaml
mea-culpa has quit [Remote host closed the connection]
zpe has quit [Ping timeout: 244 seconds]
ely-se has quit [Quit: Leaving...]
jprakash has joined #ocaml
ely-se has joined #ocaml
ygrek has joined #ocaml
swistak35 has quit [Quit: ZNC - http://znc.in]
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
tkelman has joined #ocaml
shinnya has joined #ocaml
yomimono has joined #ocaml
ygrek has quit [Ping timeout: 260 seconds]
zpe has joined #ocaml
zpe has quit [Ping timeout: 244 seconds]
MercurialAlchemi has quit [Ping timeout: 244 seconds]
ygrek has joined #ocaml
ely-se has quit [Quit: Leaving...]
jprakash has quit [Ping timeout: 246 seconds]
jprakash has joined #ocaml
Haudegen has quit [Ping timeout: 256 seconds]
|jbrown| has quit [Ping timeout: 255 seconds]
Haudegen has joined #ocaml
jprakash has quit [Ping timeout: 264 seconds]
pyon has joined #ocaml
pyon is now known as Guest33747
Guest33747 has quit [Client Quit]
dinasor has joined #ocaml
Haudegen has quit [Ping timeout: 260 seconds]
madroach has quit [Ping timeout: 264 seconds]
madroach has joined #ocaml
zpe has joined #ocaml
Haudegen has joined #ocaml
zpe has quit [Ping timeout: 260 seconds]
ygrek has quit [Ping timeout: 252 seconds]
tkelman has quit [Quit: Page closed]
ygrek has joined #ocaml
ygrek has quit [Ping timeout: 260 seconds]
hbar has joined #ocaml