<discocaml>
<deepspacejohn> I’ve noticed that seemingly-small changes in a mll file (that still parses the exact same syntax) can make relatively large differences in the compiled output (I’ve noticed just from looking at jsoo output file size). I’m wondering if there are any general guidelines for what things make ocamllex output bigger?
<discocaml>
<._null._> Differences in the ml output you mean ?
TrillionEuroNote has quit [Ping timeout: 245 seconds]
<discocaml>
<deepspacejohn> I’m measuring the final compiled output (using jsoo in my case) but yea I assume the ml output size scales relatively linearly with that. So knowing that would be helpful too.
TrillionEuroNote has joined #ocaml
<discocaml>
<._null._> Can you not access the ml intermediate file in the build folder ?
<discocaml>
<deepspacejohn> I can, but I don't know how to inspect which parts of the ml file map to the mll rules/patterns. Perhaps a better question would be: how do you debug the generated `lex_tables` value? It's the part of the code that varies the most.
<discocaml>
<._null._> You can already study the diff, but I cn't help you further
<discocaml>
<._null._> You can already study the diff, but I can't help you further
leah2 has quit [Ping timeout: 258 seconds]
waleee has quit [Ping timeout: 245 seconds]
TrillionEuroNote has quit [Ping timeout: 245 seconds]
TrillionEuroNote has joined #ocaml
chrisz has quit [Ping timeout: 246 seconds]
chrisz has joined #ocaml
spip has quit [Quit: Konversation terminated!]
azimut_ has joined #ocaml
azimut has quit [Ping timeout: 240 seconds]
smko has joined #ocaml
smko has quit [Ping timeout: 245 seconds]
TrillionEuroNote has quit [Ping timeout: 245 seconds]
TrillionEuroNote has joined #ocaml
leah2 has joined #ocaml
smko has joined #ocaml
brettgilio has quit [Quit: Ping timeout (120 seconds)]
brettgilio has joined #ocaml
azimut_ has quit [Remote host closed the connection]
azimut has joined #ocaml
smko has quit [Quit: Lost terminal]
bartholin has joined #ocaml
Serpent7776 has joined #ocaml
<greenbagels>
btw companion_cube thanks for the help earlier
<greenbagels>
async may still be slight voodoo to me but slowly but surely I will make sense of it
azimut has quit [Ping timeout: 240 seconds]
smko has joined #ocaml
bartholin has quit [Quit: Leaving]
dhil has joined #ocaml
Tuplanolla has joined #ocaml
smko has quit [Ping timeout: 246 seconds]
spip has joined #ocaml
quernd8 has quit [Read error: Connection reset by peer]
quernd8 has joined #ocaml
smko has joined #ocaml
smko has quit [Ping timeout: 246 seconds]
alexherbo2 has joined #ocaml
gareppa has joined #ocaml
<discocaml>
<sjver> how does OCaml figure out the parameter count of an external function?
<discocaml>
<sjver> does it just assume that external functions never return functions?
<discocaml>
<sjver> in other words, how does the lowering/codegen phase of the compiler know the arity of an external function?
<discocaml>
<contificate> it knows the type and uncurries it
<discocaml>
<contificate> was my understanding of `external`
<discocaml>
<sjver> so it is assumed that an external function never returns a function?
<discocaml>
<contificate> well, C can return closures to OCaml in the same way C and take closures from OCaml
<discocaml>
<contificate> but I think, for convenience, I _believe_ `external foo : int -> in -> int = "caml_foo"` would expect a C function taking 2 arguments
<discocaml>
<contificate> but I think, for convenience, I _believe_ `external foo : int -> int -> int = "caml_foo"` would expect a C function taking 2 arguments
<discocaml>
<contificate> well, C can return closures to OCaml in the same way C can take closures from OCaml
<discocaml>
<sjver> yes, but how abt `external create_adder : int -> (int -> int)`, which would return a closure?
<discocaml>
<sjver> for example
<discocaml>
<contificate> yes, I believe you can do that
<discocaml>
<sjver> but isn't `int -> int -> int` semantically the same as `int -> (int -> int)`?
<discocaml>
<contificate> yes, but I think there's some implementation detail note about this, for convenience it's not identical
<discocaml>
<contificate> but I may be completely misremembering
<discocaml>
<contificate> could try it and see™️
<discocaml>
<sjver> hmm
alexherbo2 has quit [Ping timeout: 246 seconds]
<discocaml>
<contificate> nevermind, what I said first appears to be right
<discocaml>
<contificate> > The arity (number of arguments) of a primitive is automatically determined from its OCaml type in the external declaration, by counting the number of function arrows in the type. For instance, seek_in above has arity 2, and the caml_ml_seek_in C function is called with two arguments.
<discocaml>
<contificate> confusingly, the manual also notes "Primitives with several arguments are always curried." but I presume this is talking about OCaml's own primitives where they'd never use a tuple to emulate multiple arguments since they probably do some clever stuff for handling C FFI efficiently (but there is a cap on number of arguments to the C back-end iirc)
<discocaml>
<sjver> prob yea
<discocaml>
<sjver> btw, do you happen to know of any documentation of OCaml's execution model?
<discocaml>
<contificate> what do you mean
<discocaml>
<sjver> how it generates code for function application, mainly
<discocaml>
<sjver> idk if it uses eval/apply, push/enter or smth else
<discocaml>
<sjver> but i wanna figure out
TrillionEuroNote has quit [Ping timeout: 246 seconds]
TrillionEuroNote has joined #ocaml
<discocaml>
<.armael.> for external functions I think it uses a syntactic criterion
smko has joined #ocaml
<discocaml>
<.armael.> `external foo : int -> (int -> int) = "caml_foo1"` means that the C function `caml_foo1` will take a single argument and must return a function
<discocaml>
<.armael.> whereas `external foo : int -> int -> int = "caml_foo2"` means that the C function `caml_foo2` will take two arguments and return an int
<discocaml>
<.armael.> (ah right you figured that out already :p)
<discocaml>
<contificate> caml_foo1 will expect 2 arguments, as it turns out
<discocaml>
<.armael.> ah, my bad, you're right…
<discocaml>
<.armael.> the manual indeed mentions that you need to add a type abbreviation if you want to hide the arrow
waleee has quit [Ping timeout: 246 seconds]
waleee has joined #ocaml
waleee has quit [Ping timeout: 250 seconds]
smko has quit [Ping timeout: 245 seconds]
smko has joined #ocaml
smko has quit [Ping timeout: 246 seconds]
smko has joined #ocaml
smko has quit [Ping timeout: 264 seconds]
smko has joined #ocaml
smko has quit [Ping timeout: 246 seconds]
smko has joined #ocaml
smko has quit [Ping timeout: 252 seconds]
smko has joined #ocaml
smko has quit [Ping timeout: 246 seconds]
smko has joined #ocaml
smko has quit [Ping timeout: 246 seconds]
smko has joined #ocaml
smko has quit [Ping timeout: 245 seconds]
smko has joined #ocaml
TrillionEuroNote has quit [Ping timeout: 245 seconds]
smko has quit [Ping timeout: 246 seconds]
TrillionEuroNote has joined #ocaml
smko has joined #ocaml
smko has quit [Ping timeout: 245 seconds]
smko has joined #ocaml
smko has quit [Ping timeout: 246 seconds]
smko has joined #ocaml
azimut has joined #ocaml
alexherbo2 has joined #ocaml
alexherbo2 has quit [Ping timeout: 246 seconds]
smko has quit [Ping timeout: 245 seconds]
alexherbo2 has joined #ocaml
smko has joined #ocaml
wingsorc has joined #ocaml
bartholin has joined #ocaml
alexherbo2 has quit [Remote host closed the connection]
alexherbo2 has joined #ocaml
gareppa has quit [Quit: WeeChat 3.8]
alexherbo2 has quit [Remote host closed the connection]
smko has quit [Quit: Lost terminal]
alexherbo2 has joined #ocaml
alexherbo2 has quit [Remote host closed the connection]
xd1le has joined #ocaml
dhil has quit [Ping timeout: 246 seconds]
waleee has joined #ocaml
Serpent7776 has quit [Ping timeout: 245 seconds]
bartholin has quit [Quit: Leaving]
dh` has quit [Read error: Connection reset by peer]
dh` has joined #ocaml
sagax has quit [Ping timeout: 240 seconds]
<discocaml>
<cy_tek> Hi everyone 🙂 I was just wondering if there's a reason major libraries seem to make and prefer solely Unix instead of also Windows. I notice that JaneStreet has `core_unix` and a lot of Async/Multithreading documentation/libraries seem to cater exclusively towards Unix. This is even done in one of what I can tell to be more popular books on OCaml (Real World OCaml ver 2).
<discocaml>
<cy_tek>
<discocaml>
<cy_tek> I was just curious if it's a lack of developers creating things for Windows, if OCaml as a language doesn't support Windows very well, or what the case was 🙂
<discocaml>
<uberpyro181> ocaml support for windows is very new (roughly since the start of the year), and last i checked the support was still rather spotty / rudimentary
<discocaml>
<uberpyro181> so since ocaml was unix-only for a long time, most of the resources and libraries available are in the context of unix
<discocaml>
<uberpyro181> ocaml support for windows is new (roughly since the start of the year, with the ocaml 5 release), and last i checked the support was still rather spotty / rudimentary
<discocaml>
<cy_tek> Ahh, okay 🙂 Thanks for the additional context! I might start looking at if there are any areas I might be able to contribute to. Are there any areas in particular that you know of that may be looking for contributers in that area?
TrillionEuroNote has quit [Ping timeout: 246 seconds]