adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml 4.07.1 release notes: https://caml.inria.fr/pub/distrib/ocaml-4.07/notes/Changes | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml | Due to ongoing spam, you must register your nickname to talk on the channel
<cemerick> companion_cube: if you mean the discourse site, done: https://discuss.ocaml.org/t/basic-gitlab-ci-configuration/3327
<companion_cube> well somewhere where it could be googled in the future
<cemerick> sure
<cemerick> I really don't grok the canned scripts @ https://github.com/ocaml/ocaml-ci-scripts given the existence of the prefab docker images
loli has quit [Ping timeout: 250 seconds]
ziyourenxiang has joined #ocaml
loli has joined #ocaml
emily has joined #ocaml
emily is now known as Guest22571
Guest22571 has quit [Client Quit]
emily__ has joined #ocaml
emily__ has quit [Client Quit]
emily has joined #ocaml
emily is now known as Guest35520
Guest35520 has quit [Client Quit]
emily__ has joined #ocaml
emily__ has quit [Client Quit]
emily has joined #ocaml
themsay has quit [Ping timeout: 250 seconds]
themsay has joined #ocaml
spew has quit [Quit: Connection closed for inactivity]
pierpal has quit [Ping timeout: 245 seconds]
stephe has joined #ocaml
chenglou has joined #ocaml
nkaretnikov has joined #ocaml
rfv has joined #ocaml
gonz_ has joined #ocaml
bytesighs has joined #ocaml
vinoski has joined #ocaml
mildtaste has joined #ocaml
AnAverageHuman has quit [Ping timeout: 256 seconds]
Armael has joined #ocaml
zozozo has joined #ocaml
<sagax> hi all!
loli has quit [Ping timeout: 272 seconds]
<sagax> how to print any type?
IbnFirnas has quit [Remote host closed the connection]
Denommus has quit [Ping timeout: 246 seconds]
<cemerick> utop has some magic to allow that, not sure where that comes from tho
seastack has joined #ocaml
loli has joined #ocaml
silver has quit [Read error: Connection reset by peer]
<companion_cube> cemerick: it's only there because utop has access to the compiler
<companion_cube> sagax: there is no way. Use ppx_deriving.show
<cemerick> companion_cube: really, I figured it was using Obj majicks or something
dedgrant has quit [Ping timeout: 246 seconds]
caente has joined #ocaml
FreeBirdLjj has joined #ocaml
pierpal has joined #ocaml
loli has quit [Ping timeout: 245 seconds]
<companion_cube> utop does, a bit, I think, but it's also possible because it literally has access to the types
pierpal has quit [Ping timeout: 246 seconds]
loli has joined #ocaml
caente has quit [Quit: Konversation terminated!]
marvin3 has quit []
pierpal has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
CcxWrk has quit [Ping timeout: 250 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
CcxWrk has joined #ocaml
tormen has joined #ocaml
jack5638 has quit [Ping timeout: 250 seconds]
jack5638 has joined #ocaml
tormen_ has quit [Ping timeout: 268 seconds]
gravicappa has joined #ocaml
loli has quit [Ping timeout: 240 seconds]
AnAverageHuman has joined #ocaml
FreeBird_ has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 246 seconds]
loli has joined #ocaml
AnAverageHuman has quit [Ping timeout: 256 seconds]
ziyourenxiang has quit [Quit: Leaving]
ziyourenxiang has joined #ocaml
pierpal has quit [Quit: Poof]
pierpal has joined #ocaml
ziyourenxiang has quit [Ping timeout: 245 seconds]
FreeBird_ has quit [Remote host closed the connection]
mal`` has quit [Quit: Leaving]
FreeBirdLjj has joined #ocaml
mal`` has joined #ocaml
loli has quit [Ping timeout: 245 seconds]
loli has joined #ocaml
jao has quit [Ping timeout: 240 seconds]
mal`` has quit [Quit: Leaving]
mal`` has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Read error: Connection reset by peer]
loli has quit [Ping timeout: 245 seconds]
ziyourenxiang has joined #ocaml
loli has joined #ocaml
zmt01 has quit [Read error: Connection reset by peer]
zmt00 has joined #ocaml
kakadu_ has joined #ocaml
freyr69 has joined #ocaml
<sagax> how to print bool value?
<aecepoglu[m]> sagax: how do you print any value?
<sagax> boolean it's not any
<sagax> i can't print any value
<aecepoglu[m]> as in you can't `print_endline "any value"` ?
<sagax> >> This expression has type bool but an expression was expected of type
<sagax> let b = true;;
<sagax> print_endline b;;
<aecepoglu[m]> string_of_*
<sagax> thanks
<freyr69> or Printf.printf "%b"
sagotch has joined #ocaml
loli has quit [Ping timeout: 268 seconds]
<freyr69> Why does Ipaddr lack equality?
loli has joined #ocaml
<sagax> uff, how to debug code? because do it with some `print_*` it's very hard
<sagax> I just try to understand the code better
powerbit has joined #ocaml
Haudegen has joined #ocaml
<vsiles> sagax: ocamldebug ?
<sagax> may be, will try
<freyr69> Ocamldebug is nearly useless
<freyr69> Print is fine if you know the codebase
<freyr69> GDB+repl+tests do the trick
<freyr69> Hopefully GDB/LLDB experience would be improved significantly in 4.09
monstasat has joined #ocaml
kakadu_ has quit [Remote host closed the connection]
<monstasat> Hi! when I inherit from a class (i will name it `parent`) which is also inherited from another class (i will name it `origin`), can I call the method of origin without calling the method of parent in the resulting class?
ziyourenxiang has quit [Quit: Leaving]
nikivi has quit [Quit: ZNC is awesome]
keep_learning has quit [Quit: Ping timeout (120 seconds)]
nikivi has joined #ocaml
<monstasat> here is the code: https://pastebin.com/zNQfqFTL
<monstasat> with the explanation of the desired inheritance result
<sagotch> Hello. Is there a way to marshal trivial functions like `let f i = [|"a";"b"|].(i)` such as it can be read in another program?
cantstanya has quit [Remote host closed the connection]
cantstanya has joined #ocaml
xorpse has joined #ocaml
ollehar has joined #ocaml
<freyr69> monstasat: keep a reference to the parent.
fantasticsid has joined #ocaml
fantasticsid has quit [Client Quit]
fantasticsid has joined #ocaml
loli has quit [Ping timeout: 240 seconds]
fantasticsid has quit [Quit: ERC (IRC client for Emacs 27.0.50)]
orbifx has joined #ocaml
loli has joined #ocaml
Birdface has joined #ocaml
<vsiles> freyr69: ocamldebug is crap but there are some ui to make it better (emacs, red, ...)
Birdface has quit [Ping timeout: 240 seconds]
dhil has joined #ocaml
Birdface has joined #ocaml
dexter has left #ocaml [#ocaml]
loli has quit [Ping timeout: 250 seconds]
Haudegen has quit [Remote host closed the connection]
loli has joined #ocaml
asymptotically has joined #ocaml
silver has joined #ocaml
ggole has joined #ocaml
sagotch has quit [Quit: Leaving.]
kroot_ has joined #ocaml
jbrown has quit [Ping timeout: 250 seconds]
<freyr69> vsiles: it works with bytecode only, I think that's the main problem
loli has quit [Ping timeout: 244 seconds]
q9929t has joined #ocaml
pierpal has quit [Remote host closed the connection]
jao has joined #ocaml
loli has joined #ocaml
q9929t has quit [Quit: q9929t]
sagotch has joined #ocaml
nojb[m] has joined #ocaml
<vsiles> freyr69: true
<Armael> sagotch: not really AFAIK. I guess your best bet is to define the AST of such functions, and serialize that
<Armael> (and you'd write an interpreter function for the AST)
nojb_[m] has joined #ocaml
<sagotch> I could, but as I am marshiling an AST for runtime execution optimization, I think that it's not worth it to bother optimixing that part. It would not be as trivial as regular marshaling, that's why I was hoping for some special for trivial function not depending on the local environment :)
dhil has quit [Ping timeout: 244 seconds]
<freyr69> sagotch: What do you want to achieve? Semi-manual code optimizations like loop unrolling?
<freyr69> Then you could take a look at metaocaml
<sagotch> I am trying to inline some code in a jingoo AST (https://github.com/tategakibunko/jingoo/blob/master/src/jg_types.mli#L122)
<sagotch> I have HUGE i18n function, and I am trying to inline call to this function so I would not need to have the whole data loaded in memory in the server
<sagotch> Some keys take arguments (Like in a printf format), so I cannot inline the result at compilation time, but I would like to inline a function taking missing arguments which would be applied by AST interpreter
<sagotch> In short, I want to write a `Tfun of (?kwargs:kwargs -> tvalue -> tvalue)` value with my compiler, and read it back in my server.
<freyr69> sagotch: then if the receiving program is also in OCaml you could use standard marshal, or serialize it to json using ppx_deriving_yojson
<freyr69> Though standard marshal is working only for the programs compiled with the same compiler, so I would stick to json
<freyr69> same version*
<sagotch> Hum... maybe that I misunderstood the doc
<octachron> You cannot serialize functions like that? Marshalling function and reading back only works from within the same program
<sagotch> "In this case, the output of marshaling can only be read back in processes that run exactly the same program, with exactly the same compiled code"
<sagotch> Yes, octachron that is what I thought
<octachron> Since you are doing i18n could you not serialize format "strings"?
themsay has quit [Ping timeout: 250 seconds]
themsay has joined #ocaml
<sagotch> The value of "!languages" is associated to _de_1
<sagotch> the nth argument depends on runtime value
loli has quit [Ping timeout: 268 seconds]
AnAverageHuman has joined #ocaml
jbrown has joined #ocaml
<octachron> On this lone example, marshalling the array seems much simpler? Otherwise, marshalling a small DSL Ast is indeed an option
FreeBirdLjj has joined #ocaml
loli has joined #ocaml
<sagotch> I'll probably try the small DSL indeed
Mayoi is now known as erkin
OhCamel has joined #ocaml
OhCamel has quit [Quit: Page closed]
MK__ has joined #ocaml
<cemerick> speaking of the limits of Marshal...`from_channel` appears to segfault when loading data marshaled when a subject type has a field added to it. Is this expected?
spew has joined #ocaml
<cemerick> to answer my own question, yes: https://inbox.ocaml.org/caml-list/557A8CBB.5050306@inria.fr/T/
<Drup> Marshal should only be used when you are sure about everything: you need to be sure that the source is trustable and that the message is exactly the type you expect
<Drup> If you are not sure, use json/xml/whatever
<MK__> I'm looking at assembly representation of a pattern-matching statement. However, looks like there is a difference in the numbers in OCaml and in assembly. Is there any good documentation on how the translation works?
<ggole> MK__: an ocaml int n is represented as 2*n + 1
<ggole> This is done so that the GC can tell what is an int and what is a pointer.
<MK__> Ah! Interesting
<MK__> Can you explain it a bit more?
<ggole> There's a nice section of value representations in RWO, if you are interested in that kind of thing
<MK__> Sure, can you please send me a link?
<ggole> *on
<MK__> Awesome!
<ggole> If you are comfortable reading assembly, you should be able to see how it works
<MK__> Doesn't that mean, the max value of an integer in OCaml is almost half compared to, for instance, C?
<ggole> It can also be helpful to look at the compiler's intermediate forms, with -d<foo> (run ocamlc --help) to see the list
<ggole> Yes
<ggole> If you need native width integers, they are provided in the Int32/64 modules.
<cemerick> Drup: clearly! :-) Just putting e.g. the version number of the essential library containing the types in question at the head of each marshaled file of data will be a reasonable safeguard.
<cemerick> Marshal seems to be the sole option for serializing data with cycles though, so other options aren't.
<MK__> Is there any performance difference in using Int32/64 vs native ints?
<Armael> yes, Int32/64 values are boxed
<MK__> And how does GC handles Int32/64 types?
<ggole> Yes, the 32/64 bit ints are (usually) boxed and are quite slow
monstasat has quit [Quit: Leaving]
<Drup> cemerick: cycles are tricky indeed. iirc, sexp handle them. I think one of the binary serializer (binprot/protobuf/binio) also does
<ggole> Sometimes the compiler is smart enough to unbox them, in which case they are about the same speed.
<cemerick> protobufs don't, and bin_prot doesn't
<cemerick> eh, "JSON but faster" isn't really the value prop I'm after. Marshal will do just fine
loli has quit [Ping timeout: 240 seconds]
<companion_cube> what do you mean, sexp handles cycles?
<companion_cube> (at Drup)
loli has joined #ocaml
<Drup> doesn't the janestreet version handle cycles ?
<companion_cube> I never heard of that, how do they do it? how do they represent the cycles?
<ggole> I don't think Jane St's sexps allow cycles
<ggole> Common Lisp does, though
<ggole> eg, #1=(foo #1 #1)
<companion_cube> because it's not S-expressions but lisp?
<Drup> companion_cube: aren't s-expressions just lisp values ? :3
<companion_cube> no, they're text representation
<companion_cube> lisp values are memory blocks
dhil has joined #ocaml
<ggole> That's the textual representation of sharing in Lisp
* cemerick thinks, "oh no, the ML-ers are talking about lisp" ;-D
<Drup> cemerick: it's the privilege of PLT nerds to talk about any language they like, including the ones they don't want to use :3
<ggole> Of course the actual conses that result from reading that are memory blocks that point at each other
<companion_cube> ggole: oh ok, the reader accepts this directly?
<ggole> Yes.
<companion_cube> nice,it's like a µ binding
<cemerick> Drup: for sure, with the inevitable caveat that the hot takes on things outside of one's typical tribe are often wrong
<ggole> And the printers will emit it if you ask nicely
<companion_cube> sadly I don't see how it would work with deriving
<Drup> cemerick: ah, but the goal is not always to criticize, but often to take the good bits in other things (like here, for instance) ;)
<companion_cube> detecting cycles is hard
<cemerick> quite
<Drup> (sometimes the goal is definitely to troll tho, but eh)
<ggole> Yeah, I think you need eq-tables for it to work, and OCaml doesn't have those.
<companion_cube> cemerick: bu-bu-but lisp is untyped :((
<Drup> ggole: well, that's not exactly true ...
<cemerick> companion_cube: if that was intentional, well done :-D
<ggole> Drup: you might be able to use tables from C, if the work was done all at once with no GCs
<companion_cube> intentionally a bad hot take? :P
<cemerick> super-steamy
<companion_cube> ggole: that's the issue, it's not very deriving-esque :D
<cemerick> the filthiest lisp serialization mechanism is v8 heap snapshots for your clojurescript app
<companion_cube> you could have marshal that prints S-expressions, but it'd still have to be in C
<Drup> ggole: 1) there is always gregoire Henry's work
<ggole> Drup: the name doesn't ring a bell
<ggole> Was this that hash-consing thing?
<Drup> And the second thing I was think of was : https://arxiv.org/abs/1812.11665v1
<def`> (eq-table for OCaml https://github.com/let-def/grenier/blob/master/physh/physh.mli :P, I would not recommend using them in production, but if there are uses for them, it would help to push them upstream)
<Drup> def`: not that one: https://github.com/let-def/phystable ?:)
<def`> Drup: ported to jbuilder, etc :)
<def`> also, I use more C stubs to better control allocations
<Drup> I need to remember to reference the one in grenier then. I only remember that one
<ggole> def`: nice, I've often wanted such tables
<Drup> maybe I should try to implement Eliom's serialization with it
<ggole> Usually you can hack in an id field or something for types you are defining yourself, but that's not always possible
<Drup> And compare speed
<def`> Drup: I have an implementation of marshal that use a similar table. The overhead of graph marking compared to using blue bit is around ~2.5x
<Drup> that's ... very reasonable
<def`> yep, that's just the overhead of marking, not of the actual copy
<Drup> (in particular, it's lower than triggering a GC, disabling compaction, walking through the structure while replacing lot's of stuff, and then marshal :D)
<ggole> Presumably that will be even more reasonable if multicore lands
<Drup> (yes, this is what eliom does)
<def`> This implementation is definitely not multicore safe, but MCGC comes with its own implementation of marshal.
<def`> That might help pushing eq-table in the standard library.
<ggole> Does it use eq-tables under the hood?
<def`> Yes.
<ggole> Well, exposing them seems pretty reasonable.
<def`> Some words of caution: as far as I remember, yes.
<ggole> Right, right.
jbrown has quit [Ping timeout: 268 seconds]
<Drup> I remember stephen saying something similar to me
jbrown has joined #ocaml
MK__ has quit [Ping timeout: 256 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
gaze__ has joined #ocaml
loli has quit [Ping timeout: 272 seconds]
ollehar has quit [Ping timeout: 268 seconds]
loli has joined #ocaml
marvin2 has joined #ocaml
nicoo has quit [Remote host closed the connection]
nicoo has joined #ocaml
freyr69 has quit [Remote host closed the connection]
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 268 seconds]
tane has joined #ocaml
FreeBirdLjj has joined #ocaml
jao has quit [Ping timeout: 246 seconds]
TC01 has quit [Ping timeout: 250 seconds]
AnAverageHuman has quit [Ping timeout: 256 seconds]
orbifx has quit [Quit: WeeChat 2.3]
loli has quit [Ping timeout: 246 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 246 seconds]
dhil has quit [Ping timeout: 258 seconds]
TC01 has joined #ocaml
loli has joined #ocaml
dhil has joined #ocaml
ggole has quit [Quit: Leaving]
r3s1stanc3 has quit [Quit: ZNC 1.7.2 - https://znc.in]
r3s1stanc3 has joined #ocaml
MasseR has quit [Ping timeout: 246 seconds]
MasseR has joined #ocaml
jnavila has joined #ocaml
sagotch has quit [Ping timeout: 240 seconds]
assemblyman has joined #ocaml
GreyFaceNoSpace has joined #ocaml
dedgrant has joined #ocaml
loli has quit [Ping timeout: 258 seconds]
jnavila has quit [Ping timeout: 246 seconds]
dedgrant has quit [Quit: Leaving]
dedgrant has joined #ocaml
loli has joined #ocaml
Jesin has quit [Quit: Leaving]
_whitelogger has quit [Remote host closed the connection]
_whitelogger_ has joined #ocaml
sheijk has joined #ocaml
ohama has joined #ocaml
Enjolras_ has joined #ocaml
picolino has joined #ocaml
Ulrar has joined #ocaml
leah2 has joined #ocaml
igitoor has joined #ocaml
tg has quit [Ping timeout: 246 seconds]
infinity0 has joined #ocaml
Jesin has joined #ocaml
themsay has quit [Ping timeout: 250 seconds]
tg has joined #ocaml
gravicappa has quit [Ping timeout: 240 seconds]
igitoor has quit [Changing host]
igitoor has joined #ocaml
Jesin has quit [Quit: Leaving]
Jesin has joined #ocaml
themsay has joined #ocaml
themsay has quit [Ping timeout: 240 seconds]
themsay has joined #ocaml
kakadu_ has joined #ocaml
Haudegen has joined #ocaml
loli has quit [Ping timeout: 246 seconds]
Anarchos has joined #ocaml
Anarchos has quit [Remote host closed the connection]
dhil has quit [Ping timeout: 244 seconds]
Anarchos has joined #ocaml
<Anarchos> I use ocamlbuild to build a debug bytecode target
<Anarchos> but ocamldebug doesn't stop when i put a breakpoint
<Anarchos> how do you investigate such issues ?
jbrown has quit [Ping timeout: 258 seconds]
jao has joined #ocaml
loli has joined #ocaml
Cypi has quit [Remote host closed the connection]
Cypi has joined #ocaml
jbrown has joined #ocaml
assemblyman has quit [Quit: ™]
bartholin has quit [Remote host closed the connection]
Anarchos has quit [Quit: Vision[0.10.3]: i've been blurred!]
dedgrant has quit [Ping timeout: 250 seconds]
themsay has quit [Ping timeout: 246 seconds]
dedgrant has joined #ocaml
loli has quit [Ping timeout: 246 seconds]
_whitelogger has joined #ocaml
govg has joined #ocaml
loli has joined #ocaml
demonimin has quit [Quit: bye]
demonimin has joined #ocaml
asymptotically has quit [Ping timeout: 256 seconds]
vilinski has joined #ocaml
silver_ has joined #ocaml
silver has quit [Ping timeout: 245 seconds]
silver_ is now known as silver
vilinski has quit [Quit: Page closed]
sagotch has joined #ocaml
Jesin has quit [Quit: Leaving]
spew has quit [Quit: going home]
sagotch has quit [Quit: Leaving.]
Jesin has joined #ocaml
loli has quit [Ping timeout: 246 seconds]
Jesin has quit [Quit: Leaving]
q9929t has joined #ocaml
loli has joined #ocaml
q9929t has quit [Client Quit]
Birdface has quit [Ping timeout: 272 seconds]
tane has quit [Quit: Leaving]
Jesin has joined #ocaml
kakadu_ has quit [Remote host closed the connection]
Haudegen has quit [Remote host closed the connection]
marvin2 has quit []
loli has quit [Ping timeout: 272 seconds]
jbrown has quit [Ping timeout: 258 seconds]
jbrown has joined #ocaml
loli has joined #ocaml