<rwmjones>
is there some catch I should be aware of to comparing structs using Pervasives.compare? as in, two structs which when written down look identical, but compare == 1
* rwmjones
is wondering if this is memory corruption, because I can't think what else it can be
mro has quit [Ping timeout: 240 seconds]
<fluxm>
I guess the catch is, don't use Pervasives.compare 🤔
<rwmjones>
I'm just using it in a unit test, but what would the problem be?
<fluxm>
are each of those fields compared separately with compare also equal?
<rwmjones>
hmm, good question, let me check that
<companion_cube>
you mean pure OCaml records, rwmjones ?
<rwmjones>
yup
<companion_cube>
without closures or cycles?
<rwmjones>
no
<rwmjones>
however the catch is that there are lots of strings which are read from a hokey C binding that I wrote (for libxml2)
<rwmjones>
so it might be memory corruption of some sort
<companion_cube>
Gc.compact() first?
<rwmjones>
yeah I tried that already :-)
<companion_cube>
:D
<companion_cube>
ofc you did
<rwmjones>
let me compare each field and see if it's a partcular one
<rwmjones>
(this could take a while as there are a lot)
<companion_cube>
you can also print addresses with printf
<d_bot>
<ggole> What's in the records?
<companion_cube>
well, printf + a little bit of Obj 🙃
<rwmjones>
aaaaarrrggghh yes I know what it is (and comparing the fields helped - it was the very first one which failed)
<companion_cube>
\0 ?
<rwmjones>
no, it's easier than that; here's the field
<rwmjones>
and I had read back "unknown" (UnknownHV) as OtherHV "unknown"
<rwmjones>
but when they were printed, they're identical
<rwmjones>
stupid stupid stupid
<companion_cube>
oh damn
<companion_cube>
well it can happen to everyone :D
<rwmjones>
indeed :-/
<thizanne>
that's a funnier one that forgetting a semicolon, though
mro has joined #ocaml
<companion_cube>
dmbaturin: didn't realize toml could be indented
<companion_cube>
but that's cool
<dmbaturin>
companion_cube: My position is that it _should_ be indented, else it's as unreasonable as everything else unindented. :)
<dmbaturin>
But most formatters just print everything at the beginning of the line, which makes it hard to read.
mro has quit [Ping timeout: 268 seconds]
<dmbaturin>
One more thing I want to add is an option to print strings with newlines as triple-quoted multi-line strings rather than with newlines escaped.
<companion_cube>
I'm not sure i like toml much, tbh
<companion_cube>
the array thing is a bit insane
<dmbaturin>
That array thing is the reason for half the complexity in that code, I tell you!
<companion_cube>
at some point we have to accept the existing stuff
<dmbaturin>
I'm not the greatest fan of TOML, I just find it the least awful of the widely supported formats.
<dmbaturin>
Ironically it might have been easier to write a lib for UCL than a TOML lib though. :)
<companion_cube>
probably yeah
<dmbaturin>
Hhm. Multi-line string output poses some interesting problems. I'd need to escape everything _but_ newlines, or alternatively unescape newlines after running it through String.escape
<dinosaure>
rfc822-derived configuration file <3
<companion_cube>
like… email? :/
<d_bot>
<dinosaure> yes (or debian packages)
<companion_cube>
:D
<companion_cube>
that's not an appealing example
<companion_cube>
I never heard anyone praise debian packages
mro has joined #ocaml
<dmbaturin>
companion_cube: As a Debian-based system maintainer, I hate them. ;)
<d_bot>
<dinosaure> (it's a sarcasm, I spent too much time on it, so I must promote it)
<companion_cube>
if your configuration is targeted at other OCaml devs, I think S-exprs are the best compromise
<companion_cube>
at that point
mro has quit [Ping timeout: 272 seconds]
<d_bot>
<undu> that would apply only to tools in the ocaml ecosystem, rather than tools written in ocaml in general
<companion_cube>
sure
<companion_cube>
although, how hard can it be compared to learning json? :p
<d_bot>
<undu> for most devs learning json is not an issue, however. they already know json (or they think they do)
<dmbaturin>
The latter part is the problem. :)
<dmbaturin>
Well, JSON is also annoying to write and edit by hand.
<companion_cube>
and comments, trailing commas, etc.
<companion_cube>
ugh
<d_bot>
<let Butanium = raise Not_found;;> is js_of_ocaml slower than a normal linux ocaml install ?
<companion_cube>
you mean is the compiled code slower? or the compilation?
<dmbaturin>
What do you mean? Is running an executable trans-compiled with js_of_ocaml in node.js slower than running native executables?
zebrag has joined #ocaml
<dmbaturin>
I guess the answer may be seriously different for different workloads.
<companion_cube>
I think in most cases ocamlopt will make faster code
<companion_cube>
and even if you talk about IO heavy workloads, there's luv
<companion_cube>
which should be as fast as node.js :p
<companion_cube>
I think aantron is planning to base lwt.unix on it
dhil has joined #ocaml
mro has joined #ocaml
zebrag has quit [Quit: Konversation terminated!]
zebrag has joined #ocaml
neiluj has quit [Remote host closed the connection]
neiluj has joined #ocaml
henistein has joined #ocaml
henistein has left #ocaml [#ocaml]
mikess has quit [Ping timeout: 272 seconds]
bartholin has quit [Quit: Leaving]
mikess has joined #ocaml
mro has quit [Remote host closed the connection]
dhil has quit [Ping timeout: 268 seconds]
dhil has joined #ocaml
vizard has quit [Ping timeout: 272 seconds]
neiluj has quit [Ping timeout: 264 seconds]
neiluj has joined #ocaml
zebrag has quit [Read error: Connection reset by peer]
zebrag has joined #ocaml
<d_bot>
<monk> random but anyone know where `()` came up as the syntax for unit
<d_bot>
<monk> i see it in rust, haskell, ocaml etc
<companion_cube>
maybe ML? not sure
<d_bot>
<monk> that has to be the answer right
<d_bot>
<monk> now that i list out the languages i know that do it lol
waleee has quit [Ping timeout: 272 seconds]
waleee has joined #ocaml
dhil has quit [Ping timeout: 244 seconds]
<dh`>
it's a null tuple, it seems obvious as soon as you have tuples
<d_bot>
<monk> ah
mro has joined #ocaml
mro has quit [Remote host closed the connection]
dhil has joined #ocaml
mro has joined #ocaml
olle has quit [Ping timeout: 272 seconds]
gravicappa has quit [Ping timeout: 272 seconds]
neiluj has quit [Ping timeout: 272 seconds]
hackinghorn has quit [Quit: Leaving]
Haudegen has quit [Quit: Bin weg.]
Stumpfenstiel has joined #ocaml
neiluj has joined #ocaml
cbarrett_ has joined #ocaml
mro has quit [Read error: Connection reset by peer]
mro has joined #ocaml
cbarrett has quit [*.net *.split]
cbarrett_ is now known as cbarrett
neiluj has quit [Ping timeout: 244 seconds]
dhil has quit [Ping timeout: 244 seconds]
olle has joined #ocaml
mro has quit [Quit: Leaving...]
dhil has joined #ocaml
yoctocell has quit [Quit: C-x C-c, Shutting down OS...]
Serpent7776 has quit [Ping timeout: 268 seconds]
oriba has joined #ocaml
pmetzger has joined #ocaml
olle has quit [Ping timeout: 240 seconds]
pmetzger has quit [Remote host closed the connection]
pmetzger has joined #ocaml
mikess has quit [Ping timeout: 272 seconds]
pmetzger has quit [Ping timeout: 272 seconds]
<d_bot>
<let Butanium = raise Not_found;;> > you mean is the compiled code
<d_bot>
<let Butanium = raise Not_found;;> > slower? or the compilation?
<d_bot>
<let Butanium = raise Not_found;;> I mean to run an algorithm. In my case it's for the travelling salesman problem and I create a tree and expand it during my program. I have also a lot of array manipulation. If I want to run it for a lot of cities I'd like to do it in the fastest environment
<d_bot>
<let Butanium = raise Not_found;;> Because for now I use a windows interpreter which use js_of_ocaml
Tuplanolla has quit [Quit: Leaving.]
pmetzger has joined #ocaml
dhil has quit [Ping timeout: 252 seconds]
richbridger has joined #ocaml
mikess has joined #ocaml
Stumpfenstiel has quit [Ping timeout: 268 seconds]