<d_bot>
<dj charlie> okay new version doesn't spawn off a gazillion ocaml instances and does it all in one thing, same premise though, so very curious if anyone has any better ideas
mfp has quit [Ping timeout: 260 seconds]
amiloradovsky has quit [Remote host closed the connection]
<d_bot>
<dj charlie> but can you get the list of modules that you are associated with a package this way? not sure how to use it properly
<d_bot>
<dj charlie> just using `ocp-index print Lwt_io` just prints `Lwt_io module`
<d_bot>
<theangryepicbanana> would there happen to be a way to have an array where elements can only be uninitialized once?
<d_bot>
<theangryepicbanana> or rather, elements are initially uninitialized, but are always initialized once set
<d_bot>
<theangryepicbanana> I would rather not use `'t option array` or even `'t ref option array`
<d_bot>
<theangryepicbanana> I don't mind if accessing an uninitialized element throws an error, I just want something like this to exist
<d_bot>
<dj charlie> i hope i understand what you're looking for, have you looked at `Weak`?
<oni-on-ion>
or option t array =)
<d_bot>
<theangryepicbanana> does `Weak` have any overhead?
<d_bot>
<theangryepicbanana> I would prefer for it to not have any overhead
<d_bot>
<theangryepicbanana> register/instance members in my language are allowed to remain uninitialized as long as they are not accessed before being given a value
<d_bot>
<theangryepicbanana> so I'm not sure how to efficiently represent this behavior in ocaml
<d_bot>
<dj charlie> i'm not confident with saying either way, maybe one of the pros here will have an idea 🙂
<d_bot>
<theangryepicbanana> I can only hope. I've been stuck on this for quite a while
<d_bot>
<dj charlie> 👍
<d_bot>
<rw> Does learning `lex` and `yacc` (or equivalent) in order to save some time writing CSV schema detector/validators sound like a stupid idea?
<d_bot>
<rw> Basically, I write validations manually in Ruby right now, and I'd much prefer to write declarative descriptions of what files should look like, sort of like JSON Schema.
<d_bot>
<rw> But on first glance, I can't tell if that's what lex and yacc are for.
<d_bot>
<rw> (everything I find is talking about programming language syntax parsers)
reynir has quit [Ping timeout: 240 seconds]
reynir has joined #ocaml
berberman_ has quit [Ping timeout: 240 seconds]
berberman has joined #ocaml
tizoc has quit [Quit: Coyote finally caught me]
tizoc has joined #ocaml
nullcone has quit [Quit: Connection closed for inactivity]
mbuf has joined #ocaml
waleee-cl has quit [Quit: Connection closed for inactivity]
a-kiwi has quit [Quit: Connection closed]
narimiran has joined #ocaml
Serpent7776 has joined #ocaml
<d_bot>
<darrenldl> if it's strictly for parsing csv, using a parser combinator might be easier to get started, but lex+yacc are perfectly usable as well
<d_bot>
<colin> I'm not familiar with what would be a CSV schema but, from hazarding a guess, I think generators would be overkill.
<d_bot>
<darrenldl> but neither provides schema validation out of the box, so you'll have to roll the rules manually, or design a "CSV schema" for your tool to interpret
<d_bot>
<colin> From what I gather, a JSON schema is a structural thing that's being checked against so I can only imagine the CSV schemas are basically encoding what's expected in each field (and how many fields there are, implicitly) - feels a lot like you could just create some declarative thing that encodes that information (perhaps using regex for flexibility), split the input by `,`, then see whatever matches
<d_bot>
<colin> this kind of trial and error or heuristic-driven detection isn't really what generators are cut out for, they're designed to parse defined grammars
<d_bot>
<colin> I guess the output of a generated lexer would be more efficient and than some un-JIT'd runtime regex engine, but it won't make a difference given the length of input you probably expect (and the fact that I doubt you'd validate every row to check conformance in the same, probably expensive, way you check the initial row(s))
decentpenguin has quit [Read error: Connection reset by peer]
decentpenguin has joined #ocaml
<reynir>
Hmm, 'dune check' doesn't seem to work for me(?!) -- isn't that the command to generate .merlin files among other things?
<oni-on-ion>
not sure what generates that file
gahr has quit [Quit: leaving]
gahr has joined #ocaml
gahr has quit [Client Quit]
gahr has joined #ocaml
gahr has quit [Client Quit]
Haudegen has joined #ocaml
gahr has joined #ocaml
<vsiles>
reynir: dune build @check ?
<reynir>
vsiles: oh right, thanks!!
<vsiles>
;)
borne has joined #ocaml
mbuf has quit [Ping timeout: 246 seconds]
<d_bot>
<khady> i don't think so. But most of the time I feel that it is good enough
<d_bot>
<dj charlie> i'll poke around adding that to my workflow then ez
madroach has joined #ocaml
_whitelogger has joined #ocaml
CcxWrk has quit [Read error: Connection reset by peer]
CcxWrk has joined #ocaml
<d_bot>
<reynir> It's not nice, but you can do `ocp-browser --no-opamlib --no-stdlib -I "$(opam config var lib)/lwt"` to browse lwt (and built-ins).
CcxWrk has quit [Ping timeout: 256 seconds]
hnOsmium0001 has quit [Quit: Connection closed for inactivity]
<d_bot>
<reynir> Sorry, testing something
<d_bot>
<dj charlie> taking a suss 🙂
mbuf has joined #ocaml
<d_bot>
<reynir> ``` OCaml
<d_bot>
<reynir> {| (* below is an empty line which results in a empty message in irc *)
<d_bot>
<reynir>
<d_bot>
<reynir> |}
<d_bot>
<reynir> ```
<reynir>
hm
<d_bot>
<dj charlie> nice it's very interactive
<d_bot>
<dj charlie> can i just pump it all out without the interactivity?
<d_bot>
<dj charlie> so i could grep for module names for example?
<d_bot>
<dj charlie> man ocaml has great tooling 🙂 i love that i can use man with the programs that come with dune more than anything
<d_bot>
<dj charlie> thanks cmdliner probably 🙂
ski has quit [Ping timeout: 264 seconds]
ski has joined #ocaml
plant_enjoyer has joined #ocaml
noonien has joined #ocaml
<noonien>
hello folks
<d_bot>
<dj charlie> hello 👋
<noonien>
i'm trying to get an ocaml multicore compiler working on my nixos machine. as per <https://github.com/ocamllabs/ocaml-effects-tutorial#1-algebraic-effects-and-handlers> i've tried `opam switch 4.02.2+multicore`, however, i get an error: `No switch 4.02.2+multicore is currently installed. Did you mean 'opam switch create 4.02.2+multicore'?`. I trie
<noonien>
opam switch create, but i get another error: `No compiler matching '4.02.2+multicore' found` i'm not sure exactly how to continue
<sadiq>
noonien: you really don't want 4.02.2+multicore
<sadiq>
that's a very very old compiler
<sadiq>
yes, the multicore-opam repo's instructions will help you install 4.10.0+multicore
<noonien>
i managed to get version 4.10.0+multicore installed
<sadiq>
great
<noonien>
from what i gathered, i can use ocaml to compile to C code, is this correct? if so, how could i see the emitted C?
<noonien>
`ocamlc -output-obj -o foo.c foo.ml` seems to do the trick
<noonien>
oh, ocaml has a VM?
<mrvn>
That's not C code, that's binary.
<mrvn>
ocaml has a bytecode interpreter everywhere and native compiler for most archs.
<mrvn>
noonien: man opcamlopt
<noonien>
hmm, i'm mostly interested to see the internals of caml_resume and caml_perform, and how it interacts with the code i write.
<def>
they cannot be express as C code.
<noonien>
i see, that makes sense.
<mrvn>
def: longjmp?
<noonien>
i guessed ocaml actually transpiles to C, after which it gets compiled with some other compiler, so that fibers are actually implemented in C code, with either inline assembly, or setjmp/longjmp.
<def>
no OCaml emits assembly.
<noonien>
perform/resume either using inline assembly or setjmp/longjmp*
<def>
for everything.
<def>
setjmp/longjmp are about resetting the context, but alone they can't express multiple stacks
<noonien>
yup, you'd have to have a way of keeping track of the stacks, setting the stack pointer, and creating/changing between them when neccesary, this part i was curious about
<mrvn>
noonien: that part needs signals in C. It's really ugly.
<mrvn>
luckily ocaml emits assembly and not C
<def>
noonien: the actual management of stacks as other problems. these stacks are store in the ocaml heap, so they are managed by gc. function calls have to check whether the stack space is running out and the stack needs to be resized. so stacks can be moved and resized. they have a small guaranteed space available (16 words?! I don't know) so that leaf functions can avoid the checks.
<def>
calls to C switch to the system stack. so it is easier to stop thinking as OCaml stack being the same thing as C stack, they are managed and maintained differently.
<def>
possible exceptions (I don't know what is done today): noalloc C calls (supposedly small and fast primitives implemented in C) are maybe executed directly on ocaml stack (so they must execute in a very small space) to avoid the cost of stack switching
<def>
before effects, when there were just exceptions, setjmp/longjmp was enough (this is how ocamlcc, a C backend for OCaml, was compiling them)
<noonien>
i see, interesting
<mrvn>
I still don't get why fibers even have a stack instead of allocating each stack frame separately.
<def>
because that's super slow.
<mrvn>
def: as opposed to the million other allocs a function does?
<def>
yes
<mrvn>
it increments the heap pointer and writes the header word. Not realy expensive.
<def>
okay
<mrvn>
On the other side you wouldn't have to move stacks around.
<mrvn>
def: As you say now functions have to check the stack size and resize it. I would think that's as expensive as just allocating a stack frame of the right size.
<def>
I am not familiar with the exact implementations, but there are enough litterature on the cost of heap allocated frames
<def>
and the cost is non negligible, event with a fast GC.
<def>
Why for resizable stacks, there are known efficient implementation, even with simpler runtimes.
<def>
While* for
lnxw37d4 has quit [Quit: Bridge terminating on SIGTERM]
jimt[m] has quit [Quit: Bridge terminating on SIGTERM]
Coueek[m] has quit [Quit: Bridge terminating on SIGTERM]
peddie has quit [Quit: Bridge terminating on SIGTERM]
ptival[m] has quit [Quit: Bridge terminating on SIGTERM]
aterius has quit [Quit: Bridge terminating on SIGTERM]
BitPuffin has quit [Quit: Bridge terminating on SIGTERM]
camlriot42 has quit [Quit: Bridge terminating on SIGTERM]
mmohammadi9812 has quit [Quit: Bridge terminating on SIGTERM]
Manis[m] has quit [Quit: Bridge terminating on SIGTERM]
loxs[m] has quit [Quit: Bridge terminating on SIGTERM]
kanishkaa[m] has quit [Quit: Bridge terminating on SIGTERM]
labor[m] has quit [Quit: Bridge terminating on SIGTERM]
aspiwack[m] has quit [Quit: Bridge terminating on SIGTERM]
pqwy[m] has quit [Quit: Bridge terminating on SIGTERM]
stan[m] has quit [Quit: Bridge terminating on SIGTERM]
flux has quit [Quit: Bridge terminating on SIGTERM]
h11 has quit [Quit: Bridge terminating on SIGTERM]
dash has quit [Quit: Bridge terminating on SIGTERM]
<mrvn>
def: I bet they tested it on x86 where you basically can't have a function that doesn't use the stack. On something like ARM64 all those tiny leaf functions wouldn't use the stack at all.
<def>
if you refer to the number of available registers, AMD64 has plenty enough.
<def>
and OCaml ABI is not the same as C, it makes a different use of the stack space.
<def>
Anyway if you find some design decisions funny, there are more constructive places to share your thoughts.
<mrvn>
that's what I was refering to. x86 is really register starved so you can rarely avoid spilling to the stack.
<def>
I wrote AMD64, not ARM64.
mfp has joined #ocaml
narimiran has quit [Ping timeout: 272 seconds]
narimiran has joined #ocaml
peddie has joined #ocaml
steenuil has joined #ocaml
Serpent7776 has quit [Read error: Connection reset by peer]
Serpent7776 has joined #ocaml
aspiwack[m] has joined #ocaml
Manis[m] has joined #ocaml
stan[m] has joined #ocaml
mmohammadi9812 has joined #ocaml
ptival[m] has joined #ocaml
lnxw37d4 has joined #ocaml
dash has joined #ocaml
flux has joined #ocaml
h11 has joined #ocaml
labor[m] has joined #ocaml
Coueek[m] has joined #ocaml
jimt[m] has joined #ocaml
aterius has joined #ocaml
BitPuffin has joined #ocaml
pqwy[m] has joined #ocaml
camlriot42 has joined #ocaml
kanishkaa[m] has joined #ocaml
loxs[m] has joined #ocaml
<d_bot>
<rw> @BigOof @colin Thanks for the advice!
Haudegen has quit [Quit: Bin weg.]
a-kiwi has joined #ocaml
a-kiwi has quit [Client Quit]
mbuf has quit [Ping timeout: 240 seconds]
plant_enjoyer has quit [Quit: Leaving]
<d_bot>
<Ulugbek> What do you think if we have a section "tooling" to combine channels such as dune, opam, and maybe a new channel "editor support"?
<d_bot>
<Ulugbek> It seems like editor support related topics come up quite frequently lately
Haudegen has joined #ocaml
a-kiwi has joined #ocaml
Anarchos has joined #ocaml
waleee-cl has joined #ocaml
CcxWrk has joined #ocaml
CcxWrk has quit [Ping timeout: 240 seconds]
CcxWrk has joined #ocaml
Anarchos has quit [Ping timeout: 240 seconds]
CcxWrk has quit [Read error: Connection reset by peer]
CcxWrk has joined #ocaml
Anarchos has joined #ocaml
vicfred has joined #ocaml
Anarchos has quit [Quit: Vision[0.10.3]: i've been blurred!]
Haudegen has quit [Quit: Bin weg.]
<d_bot>
<giltho> Hi ! Is there any resource on how to use Statmemprof ? I can't find a single resource about it 😦
<hannes>
prints the first element of the list without any indentation -- I can now after opening the vbox add a print_cut, but then I get an empty line first (and then a properly indented first list element)
amiloradovsky has quit [Remote host closed the connection]
tane has joined #ocaml
<d_bot>
<octachron> You could print 2 spaces and then open the vbox without any indentation.
amiloradovsky has joined #ocaml
<hannes>
octachron: thanks, I'll go this way.
jbrown has quit [Ping timeout: 272 seconds]
jbrown has joined #ocaml
a-kiwi has quit [Quit: Connection closed]
jbrown has quit [Remote host closed the connection]
a-kiwi has joined #ocaml
narimiran has quit [Ping timeout: 260 seconds]
tmhoang has quit [Quit: Alpine Linux, the security-oriented, lightweight Linux distribution]
tmhoang has joined #ocaml
hnOsmium0001 has joined #ocaml
Serpent7776 has quit [Quit: leaving]
takside has joined #ocaml
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
amiloradovsky has quit [Remote host closed the connection]
amiloradovsky has joined #ocaml
tane has quit [Quit: Leaving]
vicfred has quit [Quit: Leaving]
oni-on-ion has quit [Read error: Connection reset by peer]