infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
govg has joined #ocaml
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
infinity0 has quit [Remote host closed the connection]
ontologiae has joined #ocaml
ontologiae has quit [Ping timeout: 240 seconds]
infinity0 has joined #ocaml
infinity0 has quit [Changing host]
infinity0 has joined #ocaml
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
infinity0 has quit [Remote host closed the connection]
govg has quit [Ping timeout: 240 seconds]
infinity0 has joined #ocaml
ryanartecona has joined #ocaml
<orbifx[m]>
anyone awake who gets first-class modules?
ryanartecona has quit [Quit: ryanartecona]
copy` has quit [Quit: Connection closed for inactivity]
mfp has quit [Ping timeout: 268 seconds]
apache2 has quit [Remote host closed the connection]
diphuser has joined #ocaml
apache2 has joined #ocaml
keep_learning has joined #ocaml
diphuser has quit [Ping timeout: 264 seconds]
pierpa has quit [Quit: Page closed]
mars0i has joined #ocaml
jack5638 has quit [Ping timeout: 246 seconds]
mars0i has quit [Client Quit]
mars0i has joined #ocaml
mars0i has quit [Client Quit]
jack5638 has joined #ocaml
mars0i has joined #ocaml
mars0i has quit [Client Quit]
diphuser has joined #ocaml
spew has joined #ocaml
govg has joined #ocaml
spew has quit [Ping timeout: 240 seconds]
AlexDenisov has joined #ocaml
seliopou has quit [Ping timeout: 240 seconds]
Simn has joined #ocaml
seliopou has joined #ocaml
govg has quit [Ping timeout: 240 seconds]
MercurialAlchemi has joined #ocaml
<zozozo>
orbifx[m]: I have used them a bit
AlexDenisov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<orbifx[m]>
How can a record be set to a type of a module type zozozo ?
<zozozo>
that's a good question, I think the way to do it is using type constraints
alfredo has joined #ocaml
<zozozo>
though, actually, a module's runtime representation is a record, so you could juste define a module type instead of a record type, and use that throughout ?
<zozozo>
however, I just woke up, so my mind is not yet fully working, :p
<orbifx[m]>
Hehe, no worries
<orbifx[m]>
I want to declare a top level record type, with a field to store an abstract type in the first-class module. So I don't have a module value yet.. I think.. I'm I right?
rossberg has quit [Ping timeout: 264 seconds]
<zozozo>
hm... I don't really understand what you're trying to do
freusque has joined #ocaml
haesbaert has joined #ocaml
ygrek has quit [Ping timeout: 240 seconds]
AlexDenisov has joined #ocaml
AltGr has joined #ocaml
zpe has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 240 seconds]
<orbifx[m]>
I want to create a top level record type, which has a field whose type is dictated by a module type
<orbifx[m]>
Or rather a type in a module
kolko has quit [Ping timeout: 255 seconds]
zpe has quit [Remote host closed the connection]
<zozozo>
I guess you'll need to access the functions in the given module ?
<orbifx[m]>
Yeah, but for a type declaration, not from within a function where I can unpack a value
zpe has joined #ocaml
kolko has joined #ocaml
swistak35 has joined #ocaml
mfp has joined #ocaml
AlexRussia has quit [Ping timeout: 240 seconds]
_y has quit [Ping timeout: 240 seconds]
tobiasBora has quit [Ping timeout: 272 seconds]
Fistine has quit [Ping timeout: 260 seconds]
Fistine has joined #ocaml
_y has joined #ocaml
tobiasBora has joined #ocaml
<octachron>
orbifx[m], a packed module is a value, since ocaml is not dependently typed, you cannot create a type from a value
<rks`>
orbifx[m]: not sure I understand what you want to do. how far off is « module type S = sig type t end type 'a r = { md : (module S with type t = 'a); x : 'a } » ?
<orbifx[m]>
rks`: yeah, I think that is it
<orbifx[m]>
I started looking at using constraints yesterday, but I 2 am there was no hope :P
<rks`>
:)
<orbifx[m]>
octachron: I figure that I can't create the type from a value, I wanted to explicitly use that the signature like rks` showed
<orbifx[m]>
I'm not sure I want runtime 'dispatching' anymore companion_cube :P
diphuser has quit [Ping timeout: 268 seconds]
<companion_cube>
heh
<orbifx[m]>
Will have to think later if that is a something that adds reasonable value
mengu has quit [Remote host closed the connection]
<flux>
I miss the deterministic resource management from C++ when doing OCaml. that's perhaps my main attraction to rust. note: I have written 0 lines of it :)
<flux>
orbifx[m]'s rust example seems pretty standard to me, it doesn't even involve the subleties (or any) of borrowing..
salios has quit [Remote host closed the connection]
<def`>
flux: can't you implement it in OCaml ?
<def`>
The with_blabla pattern is not enough?
<flux>
no.
<flux>
because sometimes you need to return lambda functions from within the with
<orbifx[m]>
flux: my perspective about OCaml's resource management is that it's very reasonable and efficient for what it does, having compared it with Haskell for example :P
salios has joined #ocaml
<flux>
for example with cohttp I'm (was?) able to leak fds by aborting transfer while it was going on
<flux>
that's pretty difficult to do accidentally in a 'properly' designed c++ app, but with ocaml it's pretty easy unless you explicitly consider some cases
<flux>
and GC is not a solution to managing resources other than memory :)
<flux>
(tracing GC to distinguish from reference counting)
freusque has quit [Quit: WeeChat 1.7]
<toolslive>
ocaml resource management is a pain.
<flux>
sadly I don't think there's a way to combine deterministic resource management and tracing GC without involving linear/unique typing :-o
<toolslive>
for example: bigarrays are not causing gc pressure, so you practically get a space leak if you don't manage them manually.
<flux>
that's strange, as there is mechanism for defining the memory pressure of external C objects
<def`>
this mechanism is not very well designed
<def`>
but I disagree with your "sadly ..." statement:
<flux>
"happily"?-)
<def`>
first you say resource management is more than memory, then you argue that GC (memory manager) prevents deterministic resource management (other than memory)
<def`>
you let the GC manage memory, and manage external resources deterministically
<beginner>
i am trying to compile a program which i want to translate to javascript via js_of_ocaml. I try to use now ocamlfind. But i still get an syntax error even though i compile the function with ocamlfind ocamlc -package js_of_ocaml.ppx -linkpkg
<beginner>
it appears that the preprocessor is not working at all, with this call
<def`>
I agree it is not "convenient", you have to design patterns for that and that sucks, but that's doable and not worse than other languages
<def`>
(except Rust that provides static tracking, but there are downsides)
<flux>
def`, but with tracing GC it's just so easy to put a non-memory resource behind a memory resource
<flux>
and then your "deterministic resource" becomes non-deterministic
<def`>
(and C++ because it is more of an habit and you are anyway walking in a minefield, and syntax for RAII is "lightweight")
<def`>
ah yes I agree
<toolslive>
problem is that there is no resource-ish type. fd's are hidden ints. and there is no type support to help you not leak them.
<def`>
there is a burden in doing that properly (attach a finalizer to deterministic resources that kill the process if it gets collected in a non deterministic fashion :P)
<flux>
in any case I think type system (linear/unique typing) might help with combining the two, but that in itself might be a big pain
<def`>
toolslive: then you wrap that?
<beginner>
the error is in this line input##value <- js (string_of_int !value);
<def`>
flux: effect system might help too
<def`>
I am quite confident it is possible to make nicer designs for resource management with effect system
<toolslive>
yes we're also doing reference counting on our shared bigarrays. :(
<flux>
def`, yes, I'm very interested what the (typed) effect system is able to do
<toolslive>
that problem is actually better solved in C++
<def`>
however this alone is not enough to ensure use after free, that would be dynamic exception, but it should allow lightweight encoding of deterministic collection.
<flux>
it seems like breath of fresh air ;-), but let's see if it ever arrives mainline ocaml..
mengu has joined #ocaml
<def`>
to ensure = to prevent (sorry ...)
<def`>
toolslive: I agree :P
<n321>
hi i have a question about fork-based parallelism and external functions via ctypes. i have a program that runs fine sequentially, but gives a malloc error (pointer being freed was not allocated) when using Parmap.
<n321>
i don't quite understand what i'm not allowed to do anymore after the fork. i assume writing to shared bigarrays. but also writing to mutable ocaml values?
<flux>
n321, so there is C code involved?
<n321>
actually, a shared fortran library.
<flux>
n321, my guess is that the C code in question has a bug related to how it is interacting with OCaml GC
<flux>
but it just isn't triggered in your other case
<flux>
for example, GC can do heap compaction that can move stuff around
<flux>
if parmap is smart (or not), it might evoke this compaction phase before forking to ensure the forked processes don't do the gc themselves immediately after forking
<n321>
it's actually a pure fortran program which i wrapped myself with ctypes. maybe i should post that somewhere?
<flux>
otherwise I don't see a reason why you wouldn't be able to do most anything after a fork
<octachron>
beginner, the ppx syntax is " input##.value := js (string_of_int !value) "
<flux>
maybe, but I must admit I won't be looking into it now :-). but as a first-stab testing measure, you should try disabling compaction with the Gc-module and see if it affects
<flux>
n321, I don't read ctypes sorry, but are you only passing Bigarrays to Fortran side?
<flux>
if that is the case, then compaction shouldn't apply (except for the ocaml-side of the big array object)
<n321>
yes, bigarrays and int and double pointers. there is a ctypes function that gives the pointer to the starting address of a bigarray. i ran it with Gc.max_overhead set to 1000000, and verbose to 0x010. a compaction was requested and done, and shortly after, i get the malloc error. i thought no compaction should happen with 1_000_000?
<adrien>
for instance, lablgtk relies on that for compaction
<adrien>
(because compaction must not happen during callbacks)
<flux>
does it disable it for the forked processes?
spew has joined #ocaml
<n321>
adrien: you mean setting it to 1_000_000 prevents automatic compaction reliably?
<adrien>
well, that's what the doc says it does, doesn't it? :)
<Drup>
(this property is used in eliom too)
<n321>
true. so i guess what i am seeing is from the call from parmap. that is before the fork, iiuc the comment in the parmap code.
<n321>
flux: if compaction happens only before the fork, can this still be the cause of the malloc error?
<flux>
if it happens after your memory allocations and ocaml pointers end up in fortran, then yes it can be
<n321>
hmm. i tried to do all allocation only within the function that gets parallelized by parmap.
mengu has quit [Remote host closed the connection]
<flux>
then it seems less likely that this the case, but unless ParMap tunes the GC values to prevent compaction, it could still happen
FreeBirdLjj has joined #ocaml
<n321>
in my test run now, with max_overhead = 1_000_000, it should not happen then though? (unless parmap itself resets Gc parameters?)
mengu has joined #ocaml
<n321>
(parmap does not seem to contain any occurrence of Gc other than the single compaction before the fork..)
<flux>
correct. note that compaction is not the only thing to worry about. if ocaml garbage collects a value that there is a pointer for in the fortran, similar problem may still occur
<n321>
hmm, but should not ctypes take care of that? i mean i use the ctypes allocation functions etc.
<n321>
do i have to make sure the memory is kept alive myself?
FreeBirdLjj has quit [Ping timeout: 260 seconds]
<flux>
I'm not familiar with ctypes, so I don't know of the range of its capabilities
mengu has quit [Ping timeout: 272 seconds]
<flux>
I would assume that much, though :)
AlexRussia has quit [Ping timeout: 240 seconds]
<beginner>
ochtacron: but that means the examples in js_of_ocaml are broken
govg has joined #ocaml
<beginner>
octachron: but that means the examples in js_of_ocaml are broken
<octachron>
beginner, some(?) examples are still using the camlp4 syntax (aka the old one) and not the ppx one.
salios has quit [Remote host closed the connection]
salios has joined #ocaml
salios has quit [Max SendQ exceeded]
jabroney has joined #ocaml
salios has joined #ocaml
mengu has quit [Quit: Leaving...]
salios has quit [Max SendQ exceeded]
salios has joined #ocaml
ryanartecona has joined #ocaml
<n321>
the plot thickens...
<n321>
1. when i replace the call to the external library with a stub, i can _still_ make ocamldebug report a malloc error. however, the native code without debugger finishes. so i am thinking there is a but in ocamldebug possibly.
<n321>
2. when actually calling the external library, the native code does raise an exception about non-finite float values, suggesting memory problems.
<n321>
3. in ctypes there are some issues where people saw unexpected freeing of memory. however iiuc in my case these do not apply.
tautologico has quit [Quit: Connection closed for inactivity]
<n321>
i'll resort to sequential evaluation for now. my best guess is that i am passing some bigarray to the children without suspecting it which they then gc and free arbitrarily. just don't know where...
<n321>
thx anyway!
AlexDenisov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Fistine has left #ocaml ["WeeChat 1.0.1"]
shinnya has quit [Ping timeout: 260 seconds]
kakadu has quit [Ping timeout: 260 seconds]
ygrek has joined #ocaml
AlexRussia has joined #ocaml
Anarchos has joined #ocaml
malc_ has quit [Remote host closed the connection]
ontologiae has joined #ocaml
AltGr has left #ocaml [#ocaml]
spew has quit [Ping timeout: 240 seconds]
tane has joined #ocaml
copy` has joined #ocaml
nicooo has quit [Remote host closed the connection]
zaquest has quit [Ping timeout: 240 seconds]
zaquest has joined #ocaml
kakadu has joined #ocaml
Simn has quit [Ping timeout: 240 seconds]
Simn has joined #ocaml
tautologico has joined #ocaml
salamynder has joined #ocaml
psacrifice has quit []
ontologiae has quit [Ping timeout: 240 seconds]
salamynder has quit [Ping timeout: 260 seconds]
Xadnem has joined #ocaml
AlexDenisov has joined #ocaml
spew has joined #ocaml
pierpa has joined #ocaml
Soni has quit [Read error: Connection reset by peer]
kakadu has quit [Quit: Konversation terminated!]
spew has quit [Quit: foobar]
Soni has joined #ocaml
nicooo has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
larhat has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 255 seconds]
silver_ has joined #ocaml
sillyotter has joined #ocaml
silver has quit [Ping timeout: 260 seconds]
fraggle_ has quit [Remote host closed the connection]
sillyotter has quit [Quit: WeeChat 1.4]
fraggle_ has joined #ocaml
sillyotter has joined #ocaml
sillyotter has quit [Client Quit]
sillyotter has joined #ocaml
salamynder has joined #ocaml
<salamynder>
hello there, help for static compiling needed: ld does not find the libraries...