companion_cube changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml 4.11 release notes: https://caml.inria.fr/pub/distrib/ocaml-4.11/notes/Changes | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
mxns has quit [Ping timeout: 260 seconds]
<d_bot> <darrenldl> olle: if i have a callee that creates a stack allocated item which size is only known during run time, and the caller wishes to retrieve said item (extending the lifetime), calling coventions we typically have dont support copying a return value that way afaik
<d_bot> <darrenldl>
<d_bot> <darrenldl> even say if we can copy this way, what do you do if the local variable to copy to has other items after it?
<companion_cube> imagine if you had to copy a full hashtable at each function rturn
smazga has quit [Ping timeout: 272 seconds]
<d_bot> <darrenldl> (you can do a lot of shifting, but then that's the opposite to simplicity, and fast is nowhere in sight
mbuf has joined #ocaml
andreas303 has quit [Remote host closed the connection]
andreas303 has joined #ocaml
<olle> size known only at runtime won't fly
<olle> you have to set an upper bound to everything
<olle> which is wasteful, but do we care?
<olle> RAM is big
<d_bot> <darrenldl> sure, but then c-cube's point still stands - copying a large item on every return call is slow
<olle> well, pass around a pointer?
<d_bot> <darrenldl> and while ram is big, stack is not very big
<olle> small stack is just a convention
<d_bot> <darrenldl> well if you can decide exactly everything you need up front and allocate up in initialisation, then sure
<d_bot> <darrenldl> allocate them*
<companion_cube> globals everywhere!!
<d_bot> <darrenldl> turns out globals is the solution after all (no
<olle> not globals, but yes, you have to know before a routine starts
<companion_cube> Only if things don't survive their stack frame
<companion_cube> In which case, hello rust
<d_bot> <darrenldl> one problem with allocating everything up front (so you can pass a pointer around) is, well, code analysis is hard, and you need to now determine an upperbound for all possible traces/runs
<d_bot> <darrenldl> i dont know, but it sounds like you want embed by default
<olle> yes, it's domain specific
<olle> but still I'm asking myself - in the code I've written last 2-3 years, when did I know the upper bounds?
<olle> in web dev and cronjobs etc
<olle> fetching stuff from db, often we have a limit
<olle> obviously we don't want to use that full limit at every run
<olle> if it's big
<d_bot> <darrenldl> if your lang of choice is turing complete then you will need to solve the halting problem to answer the upperbound question exactly
<d_bot> <darrenldl>
<d_bot> <darrenldl> embed people often (afaik) restrict themselves to a small subset of the lang
<olle> halting problem? no. I just say, this hashtable supports exactly 10 items. if we have more, then abort.
<olle> same with strings etc etc
<olle> unless we want to dump to harddrive
<d_bot> <darrenldl> if you have a while true loop that allocates stuff, whats the upperbound
<olle> depends on logic. :)
<d_bot> <darrenldl> if you want to disallow equivalent of said while true loop, then your lang cannot be turing complete
<olle> it's not that complicated :) take a look at an old video game
<olle> in mega man 3 you can only have 3 bullest on the screen at most
<olle> mega man 1*
<d_bot> <darrenldl> there's a difference between "the project ends up having a precise upperbound" and creating a lang where all cases are guaranteed to have an upperbound
<olle> just don't use malloc?
<d_bot> <darrenldl> disallowing only malloc is not sufficient to determining an upperbound of memory required
<olle> well, how would you write it?
<olle> recursion is one way, but without that.
<d_bot> <darrenldl> have a non turing complete lang with termination analysis/totality check would be a first step : p
<olle> nah
<olle> a while-loop has a fixed memory usage
<olle> otherwise, F*
nullcone has joined #ocaml
<d_bot> <darrenldl> ...okay you're right, since things cant escape scope, or if can, can only escape with a limit, so while loops are fine. im being silly
<olle> ^^
<d_bot> <darrenldl> well if you have a while loop that pushes items to a collection of an outer scope, that breaks the fixed memory usage promise
<d_bot> <darrenldl>
<d_bot> <darrenldl> but if you demand the programmer to set an upperbound everywhere they go...then sure i guess
<olle> that collection has a fixed size as well
<olle> you can't push anything to outer scope like that
<olle> only at function return, like in C when you return a struct (and not a pointer to a struct)
<d_bot> <darrenldl> so all loops are side effect free
<olle> nope, not the same thing
<olle> they can still read/write to memory etc
<olle> a problem I see is when a domain has domain objects with vastly different sizes, like web pages.
<olle> a web page can be tiny or huge
<d_bot> <darrenldl> but you'd set an upper bound of the size anyway
smazga has joined #ocaml
<olle> There are middle grounds between malloc and stack, like pools and regions.
<d_bot> <darrenldl> also while i said push, it's the equivalent of asking for a spot from the collection to write to, which cannt be statically checked in while loops and you'd crash at run time by running out of spots
<olle> problem with those is that you don't get the automatic "out of scope, out of memory"
<olle> darren, for sure you can still crash!
<d_bot> <darrenldl> and i would have no way of knowing how likely my setting of upperbound will crash the system in a run?
<olle> you have to keep count
<olle> if you allocate an array of 10 items, make sure you don't access outside it
<d_bot> <darrenldl> as in knowing that statically
<olle> but that's the same with malloc
smazga has quit [Ping timeout: 260 seconds]
<d_bot> <darrenldl> sorry ive gotten lost: so whats the point of all of this again if you're not trying to guarantee safety?
<d_bot> <darrenldl> if it's for simplicity, then it feels like we've drifted quite far away from it
olle has quit [Ping timeout: 240 seconds]
zebrag has quit [Quit: Konversation terminated!]
zebrag has joined #ocaml
olle has joined #ocaml
Tuplanolla has quit [Ping timeout: 246 seconds]
smazga has joined #ocaml
Jeanne-Kamikaze has joined #ocaml
mbuf has quit [Ping timeout: 246 seconds]
osa1_ has joined #ocaml
osa1 has quit [Ping timeout: 272 seconds]
smazga has quit [Ping timeout: 264 seconds]
zebrag has quit [Quit: Konversation terminated!]
zebrag has joined #ocaml
TC01 has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
<d_bot> <beheddard> I've been following ( lurking ) this saga here and watching the discuss thread, curious to hear that part unless I missed it
<d_bot> <beheddard> ( the why )
sleepydog has joined #ocaml
<d_bot> <darrenldl> the discussion on memory stuff?
<d_bot> <beheddard> Yea. Why avoid heap at to this degree unless in super restricted embedded or something
<d_bot> <darrenldl> quoting olle
<d_bot> <darrenldl> "simplicity in concept?
<d_bot> <darrenldl> or, say we use PHP at work but need some tasks to run fast. then C without malloc() could maybe be an alternative?
<d_bot> <darrenldl> since PHP is made in C, we could still use the standard lib."
<d_bot> <beheddard> Yes I read that but didn't find it good enough justification for all the effort
<d_bot> <beheddard> Why not just have little bits of C for those hot loop parts, written in whatever way makes sense, without all the hand wringing over the heap
<d_bot> <darrenldl> my problem with the subsequent system proposed by olle is it does not attempt to guarantee lack of run time out of memory crashes, so then it just reduces into an implementation of malloc with a user definable memory bound with the usual out of memory errors
<d_bot> <darrenldl> well okay the allocation would be faster i guess, since you resolve that at compile time...
<d_bot> <darrenldl> can resolve*
<d_bot> <beheddard> This kind of a model would require initializing the C stuff (so the global upfront allocations can happen and sit there for the entire run of the program) then dip into it as needed from the PHP?
<d_bot> <darrenldl> (and technically allocation could be made most efficient since you determine those in compile time...but with current state of the art memory allocators, this likely provides little benefit
<d_bot> <darrenldl> yep, upfront allocation basically
<sleepydog> what's the point of avoiding the heap?
<d_bot> <darrenldl> outside of embedded systems/hard real time constraints requirement, no clue : p
<d_bot> <darrenldl> (also hard memory upper bound requirement as well, so safety critical systems that demand guarantee of zero OOM crashes during run time etc, though sometimes people include these into the embedded category)
<sleepydog> that makes me think of things like ebpf
<sleepydog> that makes sense. for performance, though, i've been lead to believe that allocation on ocaml's minor heap isn't much slower than stack allocation.
<d_bot> <beheddard> All the stuff around limiting heap while already dipping into C for hot loop speed up is going to eat into the higher level language benefits
<d_bot> <beheddard> Unnecessary hand tying
lopex has quit [Quit: Connection closed for inactivity]
_bin has quit [Read error: Connection reset by peer]
_bin has joined #ocaml
TC01 has joined #ocaml
Haudegen has quit [Ping timeout: 256 seconds]
smazga has joined #ocaml
smazga has quit [Ping timeout: 246 seconds]
ihavelotsoffries has joined #ocaml
ihavelotsoffries has left #ocaml [#ocaml]
SomeDamnBody has joined #ocaml
smazga has joined #ocaml
smazga has quit [Ping timeout: 264 seconds]
ome has joined #ocaml
mfp has quit [Ping timeout: 256 seconds]
zebrag has quit [Quit: Konversation terminated!]
zebrag has joined #ocaml
sm2n has quit [Quit: Leaving]
tnguyen[m][m] has joined #ocaml
richbridger has quit [Read error: Connection reset by peer]
smazga has joined #ocaml
dborisog has joined #ocaml
smazga has quit [Ping timeout: 246 seconds]
Jeanne-Kamikaze has quit [Quit: Leaving]
<companion_cube> If you have size limits everywhere in your program...
<companion_cube> Like the old C compilers that limited function names to 6 chars, hence `strlen`
<companion_cube> Very 1970
smazga has joined #ocaml
zebrag has quit [Quit: Konversation terminated!]
smazga has quit [Ping timeout: 240 seconds]
zebrag has joined #ocaml
zebrag has quit [Quit: Konversation terminated!]
minimario has joined #ocaml
<SomeDamnBody> Is there a way to create a pin but don't install?
smazga has joined #ocaml
<d_bot> <hcarty> The command's help output should have something. I think -n might be it
smazga has quit [Ping timeout: 265 seconds]
<minimario> Hi everyone! I'm somewhat new to learning OCaml (I've written ~half of a ray tracer) and would love to go deeper into it over the next month or two and am willing to dedicate 100 hours or so, but am finding it a bit difficult to learn by myself. I was wondering if anyone might know of/have any open source projects that I could contribute to in
<minimario> exchange for a little bit of mentorship and guidance (kind of like Google summer of code)?
<minimario> Wasn't sure if this was the right place to ask, so apologies if so :)
smazga has joined #ocaml
waleee-cl has quit [Quit: Connection closed for inactivity]
smazga has quit [Ping timeout: 272 seconds]
sleepydog has quit [Ping timeout: 260 seconds]
_whitelogger has joined #ocaml
visage_ has joined #ocaml
smazga has joined #ocaml
<oni-on-ion> companion_cube, hehe
decentpenguin has quit [Read error: Connection reset by peer]
decentpenguin has joined #ocaml
smazga has quit [Ping timeout: 264 seconds]
smazga has joined #ocaml
smazga has quit [Ping timeout: 260 seconds]
smazga has joined #ocaml
ome has quit [Quit: Connection closed for inactivity]
smazga has quit [Ping timeout: 260 seconds]
amiloradovsky has quit [Remote host closed the connection]
amiloradovsky has joined #ocaml
narimiran has joined #ocaml
bartholin has joined #ocaml
visage_ has quit [Quit: Textual IRC Client: www.textualapp.com]
smazga has joined #ocaml
osa1_ is now known as osa1
smazga has quit [Ping timeout: 264 seconds]
smazga has joined #ocaml
smazga has quit [Ping timeout: 240 seconds]
smazga has joined #ocaml
oni-on-ion has quit [Remote host closed the connection]
smazga has quit [Ping timeout: 240 seconds]
osa1 has quit [Quit: osa1]
bitonic has quit []
jlr has joined #ocaml
narimiran has quit [Ping timeout: 264 seconds]
minimario has quit [Remote host closed the connection]
osa1 has joined #ocaml
Tuplanolla has joined #ocaml
smazga has joined #ocaml
smazga has quit [Ping timeout: 246 seconds]
hnOsmium0001 has quit [Quit: Connection closed for inactivity]
smazga has joined #ocaml
jlr has quit [Ping timeout: 272 seconds]
smazga has quit [Ping timeout: 240 seconds]
smazga has joined #ocaml
amiloradovsky has quit [Remote host closed the connection]
neiluj has joined #ocaml
olle has quit [Ping timeout: 240 seconds]
olle has joined #ocaml
Serpent7776 has joined #ocaml
smazga has quit [Ping timeout: 264 seconds]
olle_ has joined #ocaml
neiluj has quit [Quit: leaving]
osa1 has quit [Ping timeout: 272 seconds]
Haudegen has joined #ocaml
lopex has joined #ocaml
<flux> excellent timing regarding writing a raytracer in OCaml, given the almost-arrival of multicore support ;)
<olle_> just like nuclear fusion, multicore support has always been 30+ years from realization ;)
<olle_> (trolling)
<flux> true, but this time it's going to happen!
<olle_> fusion? sweet!
<olle_> they did it with laser, didn't they?
rdivyanshu has joined #ocaml
steenuil has quit [Ping timeout: 260 seconds]
smazga has joined #ocaml
<octachron> Fusion by itself is not particularly noteworthy: pinch machines were already doing fusion by 1958. The issue with fusion is scaling the design to extract more energy than the reactor is consuming. That requires to spend money for the prototype and no one was willing to do so before ITER.
<olle_> ITER?
mfp has joined #ocaml
chimay[m] has quit [Quit: authenticating]
chimay[m] has joined #ocaml
smazga has quit [Ping timeout: 246 seconds]
osa1 has joined #ocaml
aiowej has joined #ocaml
aiowej` has joined #ocaml
aiowej has quit [Ping timeout: 256 seconds]
aiowej` has quit [Read error: Connection reset by peer]
aiowej` has joined #ocaml
steenuil has joined #ocaml
vicfred has joined #ocaml
rdivyanshu has quit [Quit: Connection closed for inactivity]
waleee-cl has joined #ocaml
smazga has joined #ocaml
smazga has quit [Ping timeout: 264 seconds]
jnavila has joined #ocaml
smazga has joined #ocaml
zebrag has joined #ocaml
smazga has quit [Ping timeout: 246 seconds]
andreas303 has quit [Ping timeout: 240 seconds]
andreas303 has joined #ocaml
TheLemonMan has joined #ocaml
zebrag has quit [Quit: Konversation terminated!]
zebrag has joined #ocaml
<d_bot> <EduardoRFS> ITER also isn't ready, and it's slow. I would say multicore is close, but modular implicits? 30 years away
<d_bot> <stab> My interpretation was there isn’t much going towards modular implicits at the moment, potentially after multi ore
<sadiq> the multicore monthly updates do give you some idea of how far along multicore stuff is
<sadiq> (4.11 and 4.12 have major pieces of multicore infrastructure, 4.13 will have another piece)
<d_bot> <stab> I’ll be honest tho I don’t really get modular implicits. Like i understand why somebody might want ad hoc polymorphism but the proposed solution confuses me tbh. I have to look at the paper again
<d_bot> <stab> Maybe it’s cause I’ve never used Scala
<octachron> There are people working on modular implicits right now, but those experimentations are not at a stage where timelines make sense.
<steenuil> I understand it as just having functions take an additional module parameter, which is resolved based on its type and what's currently in scope
<d_bot> <stab> Can you parametrize the function by multiple implicit modules?
<steenuil> just make add more implicit parameters
<steenuil> s/make //
<d_bot> <stab> Yea was just asking if there were any issues with multiple implicit parameters and resolving them that would prevent that from being possible
<d_bot> <stab> So i guess the idea then is in an ad hoc way you can just parameterize functions by implicit module parameters and at some point you make them explicit. Kinda just sounds like a more loosely defined functor no? Or is that the point
<steenuil> in the version I saw they're explicit when defining the function but implicit when calling it
andreas303 has quit [Ping timeout: 240 seconds]
andreas303 has joined #ocaml
smazga has joined #ocaml
<d_bot> <EduardoRFS> I think it must always be explicit during definition, but that's okay
<d_bot> <EduardoRFS> but multicore is quite fun, especially the no-effect-syntax as everything is working out of the box now
<octachron> Seeing modular implicits as a much lighter version of functors works quite well.
<d_bot> <EduardoRFS> yup, needed higher kinded types this week, and ... it wasn't fun
smazga has quit [Ping timeout: 240 seconds]
<olle_> "needed"?
<olle_> what's wrong with void*, you fancy ivory tower academics?
zebrag has quit [Quit: Konversation terminated!]
zebrag has joined #ocaml
narimiran has joined #ocaml
smazga has joined #ocaml
<d_bot> <EduardoRFS> I don't even finished high school ... jokes aside, yeah it was to serialize GADTs stuff using `data-encoding` efficiently. So I needed a way to encode this `'a ty * 'a` being the ty the encoding of `'a` without this you would need to build an `'a encoding` for each `'a ty`
smazga has quit [Ping timeout: 264 seconds]
vicfred has quit [Ping timeout: 246 seconds]
smazga has joined #ocaml
smazga has quit [Ping timeout: 264 seconds]
smazga has joined #ocaml
olle_ has quit [Ping timeout: 264 seconds]
smazga has quit [Ping timeout: 240 seconds]
zebrag has quit [Quit: Konversation terminated!]
zebrag has joined #ocaml
tane has joined #ocaml
smazga has joined #ocaml
jbrown has quit [Ping timeout: 272 seconds]
_bin has left #ocaml [#ocaml]
Jeanne-Kamikaze has joined #ocaml
jbrown has joined #ocaml
mxns has joined #ocaml
mxns has quit [Ping timeout: 260 seconds]
aiowej` has quit [Remote host closed the connection]
zebrag has quit [Quit: Konversation terminated!]
zebrag has joined #ocaml
ArthurStrong has joined #ocaml
richbridger has joined #ocaml
smazga has quit [Ping timeout: 246 seconds]
sleepydog has joined #ocaml
Jeanne-Kamikaze has quit [Ping timeout: 264 seconds]
smazga has joined #ocaml
smazga has quit [Ping timeout: 265 seconds]
zebrag has quit [Quit: Konversation terminated!]
zebrag has joined #ocaml
TheLemonMan has quit [Ping timeout: 240 seconds]
smazga has joined #ocaml
smazga has quit [Ping timeout: 256 seconds]
hnOsmium0001 has joined #ocaml
mxns has joined #ocaml
dborisog has quit [Ping timeout: 240 seconds]
smazga has joined #ocaml
mxns has quit [Ping timeout: 264 seconds]
smazga has quit [Ping timeout: 272 seconds]
smazga has joined #ocaml
andreas303 has quit [Ping timeout: 240 seconds]
andreas303 has joined #ocaml
smazga has quit [Ping timeout: 256 seconds]
zebrag has quit [Quit: Konversation terminated!]
zebrag has joined #ocaml
<d_bot> <Kakadu> I'm looking at pattern combinators https://github.com/ocaml-ppx/ppxlib/blob/master/src/ast_pattern.mli#L130 and it looks like they are designed to be a contravariant functor.
<d_bot> <Kakadu> Question: is it common for pattern combinators to be contravariant and for parser combinators to be covariant or is it a subtlety of this concrete implementation?
<d_bot> <Kakadu> I'm probably not explaining well
smazga has joined #ocaml
bartholin has quit [Quit: Leaving]
neiluj has joined #ocaml
neiluj has quit [Changing host]
neiluj has joined #ocaml
smazga has quit [Ping timeout: 240 seconds]
<d_bot> <Kakadu> In short, I want to calculate the length of list but it seems to be too complicated 🙂
zebrag has quit [Read error: Connection reset by peer]
smazga has joined #ocaml
zebrag has joined #ocaml
smazga has quit [Ping timeout: 256 seconds]
narimiran has quit [Ping timeout: 246 seconds]
<d_bot> <craigfe> > Question: is it common for pattern combinators to be contravariant and for parser combinators to be covariant or is it a subtlety of this concrete implementation?
<d_bot> <craigfe>
<d_bot> <craigfe> Yes 🙂 A _source_ of values of type `t` (such as a parser) will typically be covariant in `t`, whereas a _sink_ for values of type `t` (such as a pattern) is typically contravariant in `t`.
aecepoglu[m] has joined #ocaml
<d_bot> <craigfe> @Kakadu: re. your example, I suspect you want to return `acc` in the `nil` base case, if you haven't noticed that already
<aecepoglu[m]> Is the presence of the file `$OCAML_TOPLEVEL_PATH/someting` sufficient for me to be abl eto say `#use ""something"";;` in my `.ocamlinit` ?
<d_bot> <Kakadu> @craigfe Cool, thanks!
<aecepoglu[m]> Because I'm trying to setup "down" for my repl and my "down.top" file exists in that path. Manually running the "#directory" and "#load" commands in it do what I need. But putting `#use "down.top";;` in my `.ocamlinit` gives a `cannot find file down.top.` error
smazga has joined #ocaml
smazga has quit [Ping timeout: 240 seconds]
zebrag has quit [Quit: Konversation terminated!]
zebrag has joined #ocaml
olle_ has joined #ocaml
andreas303 has quit [Remote host closed the connection]
andreas303 has joined #ocaml
hnOsmium0001 has quit [Quit: Connection closed for inactivity]
jnavila has quit [Ping timeout: 272 seconds]
mxns has joined #ocaml
andreas303 has quit [Ping timeout: 240 seconds]
andreas303 has joined #ocaml
vicfred has joined #ocaml
Serpent7776 has quit [Quit: leaving]