companion_cube changed the topic of #ocaml to: Discussion about the OCaml programming language | http://www.ocaml.org | OCaml 5.2.0 released: https://ocaml.org/releases/5.2.0 | Try OCaml in your browser: https://try.ocamlpro.com | Public channel logs at https://libera.irclog.whitequark.org/ocaml/
YuGiOhJCJ has quit [Ping timeout: 260 seconds]
chiselfuse has quit [Ping timeout: 260 seconds]
chiselfuse has joined #ocaml
YuGiOhJCJ has joined #ocaml
f[x] has joined #ocaml
waleee has quit [Ping timeout: 258 seconds]
motherfsck has quit [Quit: quit]
bartholin has joined #ocaml
bartholin has quit [Ping timeout: 248 seconds]
bartholin has joined #ocaml
motherfsck has joined #ocaml
f[x] has quit [Remote host closed the connection]
twobitsp1ite is now known as twobitsprite
<twobitsprite> What's the advantage of using modules over objects? I mean, I feel like `obj#meth a b` is cleaner than `Mod.func obj a b`
<discocaml> <ada2k> twobitsprite: a module can contain multiple types and group functions logically, since ocaml (thankfully) does not have static/class methods you have to initialise an object to call any method on it, and modules are generally lighter in both performance and complexity
<discocaml> <ada2k> by complexity
<discocaml> <ada2k> e.g. access to a record's field is just controlled by it being a non-opaque type, whereas objects need explicit getters and setters to lift values out of the object
YuGiOhJCJ has quit [Quit: YuGiOhJCJ]
olle has joined #ocaml
wagle has quit [Quit: No Ping reply in 180 seconds.]
wagle has joined #ocaml
dstein64 has quit [Quit: ZNC 1.8.2+deb2build5 - https://znc.in]
dstein64 has joined #ocaml
Opus has joined #ocaml
Serpent7776 has joined #ocaml
slothby has quit [Ping timeout: 244 seconds]
slothby has joined #ocaml
cr1901_ has joined #ocaml
cr1901 has quit [Read error: Connection reset by peer]
Guest11 has joined #ocaml
Guest11 is now known as lixing
<discocaml> <dinosaure> Also, objects are not on top of the priority for the OCaml core team. It's not widely used and OCaml's objects are different than Java's objects (which increases the difficulty to learn and use them).
toastal has joined #ocaml
<discocaml> <ada2k> basically, you'll know when you need them. they're a nice tool in ocaml
<discocaml> <ada2k> *niche
bibi_ has quit [Ping timeout: 260 seconds]
bibi_ has joined #ocaml
lel2 has joined #ocaml
lel2 has left #ocaml [#ocaml]
lel2 has joined #ocaml
lel2 has quit [Client Quit]
lel2 has joined #ocaml
lel2 has left #ocaml [#ocaml]
f[x] has joined #ocaml
Anarchos has joined #ocaml
lixing has quit [Quit: Client closed]
xenu has quit [Quit: leaving]
xenu has joined #ocaml
myrkraverk has quit [Read error: Connection reset by peer]
myrkraverk has joined #ocaml
dawids has joined #ocaml
olle has quit [Ping timeout: 252 seconds]
bartholin has quit [Quit: Leaving]
dawids has quit [Quit: Leaving]
waleee has joined #ocaml
f[x] has quit [Ping timeout: 260 seconds]
f[x] has joined #ocaml
<twobitsprite> ada2k: ewww, I hate getters and setters. I've never understood the point of "opaque" objects, I'm used to python's OO style. Anyways, thanks for explaining the difference to me
dh` has quit [Read error: Connection reset by peer]
<twobitsprite> modules it is, from now on XD
dh` has joined #ocaml
bartholin has joined #ocaml
toastal has left #ocaml [Disconnected: Hibernating too long]
f[x] has quit [Remote host closed the connection]
f[x] has joined #ocaml
Tuplanolla has joined #ocaml
f[x] has quit [Remote host closed the connection]
bartholin has quit [Quit: Leaving]
Serpent7776 has quit [Ping timeout: 272 seconds]
<discocaml> <barconstruction> I think getters and setters are often poorly motivated. I didn't understand them when I was learning Java on high school. I don't remember the teacher giving any examples of invariants that we wanted to maintain for objects which would have illustrated why you want to control access to the field.
cr1901_ is now known as cr1901
<discocaml> <ada2k> twobitsprite: objects are super useful when you actually do need concurrency or multiple implementations for a type
<discocaml> <ada2k> but first class modules are a powerful enough tool that objects only get used when those two things are a real benefit
<discocaml> <ada2k> think some of the JS converters use objects to represent javascript types, many i/o libraries use them too. it’s a targeted tool
waleee has quit [Ping timeout: 264 seconds]
waleee has joined #ocaml
<discocaml> <deepspacejohn> in OCaml objects are structurally typed values whereas modules contain (mostly nominal) types and values. In practice there's a difference between using an object with an `add` method and a value of `Queue.t` type that you can use `Queue.add` on.
Anarchos has quit [Quit: Vision[]: i've been blurred!]
waleee has quit [Ping timeout: 245 seconds]
torretto_ has joined #ocaml
<discocaml> <deepspacejohn> Question: is there a limit to the number of constructors an extensible variant can have, and would calling a function like this enough times reach the limit? `let f () = let module M = struct type exn += E end in raise M.E`
torretto has quit [Ping timeout: 260 seconds]