companion_cube changed the topic of #ocaml to: Discussion about the OCaml programming language | http://www.ocaml.org | OCaml 4.14.0 released: https://ocaml.org/releases/4.14.0.html | Try OCaml in your browser: https://try.ocamlpro.com | Public channel logs at https://libera.irclog.whitequark.org/ocaml/
keyboard has quit [Quit: keyboard]
perrierjouet has quit [Quit: WeeChat 3.7.1]
Haudegen has quit [Ping timeout: 252 seconds]
spip has quit [Quit: Konversation terminated!]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Tuplanolla has quit [Quit: Leaving.]
rgrinberg has joined #ocaml
chrisz has quit [Ping timeout: 252 seconds]
chrisz has joined #ocaml
motherfsck has joined #ocaml
terrorjack has quit [Ping timeout: 252 seconds]
terrorjack has joined #ocaml
xd1le has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mbuf has joined #ocaml
sagax has joined #ocaml
rgrinberg has joined #ocaml
trev has joined #ocaml
motherfsck has quit [Ping timeout: 272 seconds]
greenbagels has quit [Quit: WeeChat 3.0]
Haudegen has joined #ocaml
azimut has quit [Ping timeout: 255 seconds]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bgs has joined #ocaml
greenbagels has joined #ocaml
mro has joined #ocaml
troydm has joined #ocaml
troydm has quit [Ping timeout: 260 seconds]
bartholin has joined #ocaml
Tuplanolla has joined #ocaml
mro has quit [Quit: Leaving...]
Serpent7776 has joined #ocaml
TzilTzal has joined #ocaml
kakadu has joined #ocaml
troydm has joined #ocaml
waleee has joined #ocaml
spip has joined #ocaml
troydm has quit [Ping timeout: 256 seconds]
nfc has quit [Ping timeout: 260 seconds]
nfc has joined #ocaml
neiluj has joined #ocaml
<neiluj> Hello! after reading some generic rust code I was wondering what can you do with ocaml's modules that you can't with rust traits?
<companion_cube> Use the same type in different ways
<companion_cube> Since traits can be implemented only once per type
lobo[m] has quit [Ping timeout: 260 seconds]
mclovin has quit [Ping timeout: 265 seconds]
h11 has quit [Ping timeout: 246 seconds]
zebrag[m] has quit [Ping timeout: 252 seconds]
olle has joined #ocaml
waleee has quit [Ping timeout: 252 seconds]
kakadu has quit [Ping timeout: 252 seconds]
zebrag[m] has joined #ocaml
kakadu has joined #ocaml
waleee has joined #ocaml
alexherbo2 has joined #ocaml
xd1le has quit [Quit: xd1le]
<neiluj> companion_cube: thanks! sorry what you mean by using the same type in different ways? are you talking about functors?
<zozozo> neiluj: for instance, you can instantiate the Map functor for the same type, but with different comparison functions depending on your needs
TzilTzal has quit [Quit: Leaving.]
mclovin has joined #ocaml
h11 has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
jao has joined #ocaml
alexherbo2 has quit [Remote host closed the connection]
alexherbo2 has joined #ocaml
lobo[m] has joined #ocaml
<neiluj> oh yes thx!
<neiluj> much more powerful
motherfsck has joined #ocaml
alexherbo2 has quit [Remote host closed the connection]
rgrinberg has joined #ocaml
cedric has joined #ocaml
cedric has quit [Quit: Konversation terminated!]
Haudegen has joined #ocaml
azimut has joined #ocaml
alexherbo2 has joined #ocaml
johnbikes has joined #ocaml
xgqt has quit [Remote host closed the connection]
xgqt has joined #ocaml
bartholin has quit [Quit: Leaving]
alexherbo2 has quit [Remote host closed the connection]
alexherbo2 has joined #ocaml
waleee has quit [Ping timeout: 248 seconds]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rgrinberg has joined #ocaml
rgrinberg has quit [Client Quit]
jao has quit [Ping timeout: 264 seconds]
mbuf has quit [Quit: Leaving]
alexherbo2 has quit [Ping timeout: 260 seconds]
mro has joined #ocaml
rgrinberg has joined #ocaml
troydm has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
olle has quit [Remote host closed the connection]
rgrinberg has joined #ocaml
rgrinberg has quit [Client Quit]
johnbikes has quit [Quit: johnbikes]
neiluj has quit [Ping timeout: 260 seconds]
neiluj has joined #ocaml
mro has quit [Remote host closed the connection]
rgrinberg has joined #ocaml
<neiluj> wow, you can compare abstract types
mro has joined #ocaml
kakadu has quit [Remote host closed the connection]
mro has quit [Remote host closed the connection]
bartholin has joined #ocaml
Haudegen has joined #ocaml
<zozozo> neiluj: how so?
olle has joined #ocaml
mro has joined #ocaml
mro has quit [Remote host closed the connection]
waleee has joined #ocaml
waleee has quit [Ping timeout: 252 seconds]
waleee has joined #ocaml
mro has joined #ocaml
<neiluj> well I tried to compare two values whose type is abstract, that returned true
Haudegen has quit [Quit: No Ping reply in 180 seconds.]
<zozozo> Ah, that's the polymorphic/structural comparison, and it's.. let's say special
Haudegen has joined #ocaml
<neiluj> trying an example to verify that it's really working
<neiluj> are the rules simple?
<neiluj> I tried with an abstract type which is an int under the hood and = behaves correctly
<neiluj> module type T_sig = sig type t val of_int : int -> t end;; module T:T_sig = struct type t=int let of_int x : t = x end;;
<neiluj> (T.of_int 2)=(T.of_int 1) -> false, (T.of_int 2)=(T.of_int 2)-> true
<neiluj> nice!
trev has quit [Remote host closed the connection]
<neiluj> does it work with other types, say lists or arrays
<companion_cube> The rules are: it only knows about the runtime representation, but it can compare most things except closures
<companion_cube> Arrays, tuples, lists, etc. work
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mro has quit [Remote host closed the connection]
mro has joined #ocaml
<neiluj> awesome! thanks
<neiluj> just tried with arrays:)
<neiluj> yeah for instance you can't compare "functional values" such as Seq.t
waleee has quit [Ping timeout: 260 seconds]
<neiluj> but wait, the definition of a Seq.t is similar to that of a List.t
<neiluj> except Seq.t has that little +'a
<neiluj> instead of generic type 'a for list
motherfsck has quit [Ping timeout: 248 seconds]
<zozozo> neiluj: the thing that matters is the type definition, not the abstract type you see
rgrinberg has joined #ocaml
<zozozo> In the case of Seq.t, the type definition states that some sequences contain functions
<zozozo> As a general rule, on 'simple enough' types, the polymorphic comparison will work, but it will not on complex types (e.g. comparing maps and sets will not always return the result you expect)
<neiluj> ah, hence the term closure
<neiluj> many thanks, this clears things up a lot
<neiluj> so comparing values whose types are abstract is not that dangerous
<zozozo> It's not dangerous but: 1) it can raise some exceptions 2) it can return false when you're expect true
<companion_cube> It's to avoid for types that are not, as one would say in other languages, "plain data"
neiluj has quit [Ping timeout: 248 seconds]
motherfsck has joined #ocaml
neiluj has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Haudegen has quit [Quit: No Ping reply in 180 seconds.]
Haudegen has joined #ocaml
motherfsck has quit [Ping timeout: 260 seconds]
mro has quit [Quit: Leaving...]
olle has quit [Ping timeout: 264 seconds]
troydm has quit [Ping timeout: 246 seconds]
perrierjouet has joined #ocaml
bgs has quit [Remote host closed the connection]
bartholin has quit [Quit: Leaving]
Serpent7776 has quit [Ping timeout: 246 seconds]
xd1le has joined #ocaml
rgrinberg has joined #ocaml
neiluj has quit [Quit: WeeChat 3.6]