00:00
keyboard has quit [Quit: keyboard]
00:05
perrierjouet has quit [Quit: WeeChat 3.7.1]
00:09
Haudegen has quit [Ping timeout: 252 seconds]
00:29
spip has quit [Quit: Konversation terminated!]
00:43
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
00:53
Tuplanolla has quit [Quit: Leaving.]
00:59
rgrinberg has joined #ocaml
03:06
chrisz has quit [Ping timeout: 252 seconds]
03:08
chrisz has joined #ocaml
03:43
motherfsck has joined #ocaml
03:47
terrorjack has quit [Ping timeout: 252 seconds]
03:59
terrorjack has joined #ocaml
04:15
xd1le has joined #ocaml
04:36
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
05:00
mbuf has joined #ocaml
05:22
sagax has joined #ocaml
05:35
rgrinberg has joined #ocaml
05:51
trev has joined #ocaml
05:53
motherfsck has quit [Ping timeout: 272 seconds]
06:06
greenbagels has quit [Quit: WeeChat 3.0]
06:08
Haudegen has joined #ocaml
06:12
azimut has quit [Ping timeout: 255 seconds]
06:38
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
06:45
bgs has joined #ocaml
07:25
greenbagels has joined #ocaml
07:41
mro has joined #ocaml
07:45
troydm has joined #ocaml
07:50
troydm has quit [Ping timeout: 260 seconds]
07:53
bartholin has joined #ocaml
08:47
Tuplanolla has joined #ocaml
08:54
mro has quit [Quit: Leaving...]
09:11
Serpent7776 has joined #ocaml
09:32
TzilTzal has joined #ocaml
09:42
kakadu has joined #ocaml
09:48
troydm has joined #ocaml
09:56
waleee has joined #ocaml
10:01
spip has joined #ocaml
10:31
troydm has quit [Ping timeout: 256 seconds]
10:34
nfc has quit [Ping timeout: 260 seconds]
10:55
nfc has joined #ocaml
11:13
neiluj has joined #ocaml
11:15
<
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?
11:23
<
companion_cube >
Use the same type in different ways
11:23
<
companion_cube >
Since traits can be implemented only once per type
11:28
lobo[m] has quit [Ping timeout: 260 seconds]
11:28
mclovin has quit [Ping timeout: 265 seconds]
11:29
h11 has quit [Ping timeout: 246 seconds]
11:33
zebrag[m] has quit [Ping timeout: 252 seconds]
11:35
olle has joined #ocaml
11:39
waleee has quit [Ping timeout: 252 seconds]
11:40
kakadu has quit [Ping timeout: 252 seconds]
11:42
zebrag[m] has joined #ocaml
11:43
kakadu has joined #ocaml
11:45
waleee has joined #ocaml
12:00
alexherbo2 has joined #ocaml
12:08
xd1le has quit [Quit: xd1le]
12:10
<
neiluj >
companion_cube: thanks! sorry what you mean by using the same type in different ways? are you talking about functors?
12:15
<
zozozo >
neiluj: for instance, you can instantiate the Map functor for the same type, but with different comparison functions depending on your needs
12:20
TzilTzal has quit [Quit: Leaving.]
12:22
mclovin has joined #ocaml
12:35
h11 has joined #ocaml
12:43
Haudegen has quit [Quit: Bin weg.]
12:45
jao has joined #ocaml
12:46
alexherbo2 has quit [Remote host closed the connection]
12:47
alexherbo2 has joined #ocaml
12:50
lobo[m] has joined #ocaml
12:51
<
neiluj >
oh yes thx!
12:52
<
neiluj >
much more powerful
13:00
motherfsck has joined #ocaml
13:01
alexherbo2 has quit [Remote host closed the connection]
13:02
rgrinberg has joined #ocaml
13:04
cedric has joined #ocaml
13:24
cedric has quit [Quit: Konversation terminated!]
13:36
Haudegen has joined #ocaml
13:39
azimut has joined #ocaml
14:02
alexherbo2 has joined #ocaml
14:08
johnbikes has joined #ocaml
14:12
xgqt has quit [Remote host closed the connection]
14:13
xgqt has joined #ocaml
14:39
bartholin has quit [Quit: Leaving]
14:57
alexherbo2 has quit [Remote host closed the connection]
14:57
alexherbo2 has joined #ocaml
15:16
waleee has quit [Ping timeout: 248 seconds]
15:30
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
15:32
rgrinberg has joined #ocaml
15:35
rgrinberg has quit [Client Quit]
15:45
jao has quit [Ping timeout: 264 seconds]
15:47
mbuf has quit [Quit: Leaving]
15:49
alexherbo2 has quit [Ping timeout: 260 seconds]
16:06
mro has joined #ocaml
16:07
rgrinberg has joined #ocaml
16:27
troydm has joined #ocaml
16:40
Haudegen has quit [Quit: Bin weg.]
16:43
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
16:44
olle has quit [Remote host closed the connection]
16:46
rgrinberg has joined #ocaml
16:48
rgrinberg has quit [Client Quit]
16:51
johnbikes has quit [Quit: johnbikes]
16:51
neiluj has quit [Ping timeout: 260 seconds]
17:02
neiluj has joined #ocaml
17:04
mro has quit [Remote host closed the connection]
17:09
rgrinberg has joined #ocaml
17:09
<
neiluj >
wow, you can compare abstract types
17:19
mro has joined #ocaml
17:23
kakadu has quit [Remote host closed the connection]
17:41
mro has quit [Remote host closed the connection]
17:58
bartholin has joined #ocaml
17:59
Haudegen has joined #ocaml
18:16
<
zozozo >
neiluj: how so?
18:20
olle has joined #ocaml
18:29
mro has joined #ocaml
18:38
mro has quit [Remote host closed the connection]
19:00
waleee has joined #ocaml
19:13
waleee has quit [Ping timeout: 252 seconds]
19:36
waleee has joined #ocaml
19:52
mro has joined #ocaml
19:52
<
neiluj >
well I tried to compare two values whose type is abstract, that returned true
19:55
Haudegen has quit [Quit: No Ping reply in 180 seconds.]
19:56
<
zozozo >
Ah, that's the polymorphic/structural comparison, and it's.. let's say special
19:56
Haudegen has joined #ocaml
19:57
<
neiluj >
trying an example to verify that it's really working
19:57
<
neiluj >
are the rules simple?
20:00
<
neiluj >
I tried with an abstract type which is an int under the hood and = behaves correctly
20:01
<
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;;
20:02
<
neiluj >
(T.of_int 2)=(T.of_int 1) -> false, (T.of_int 2)=(T.of_int 2)-> true
20:02
trev has quit [Remote host closed the connection]
20:02
<
neiluj >
does it work with other types, say lists or arrays
20:04
<
companion_cube >
The rules are: it only knows about the runtime representation, but it can compare most things except closures
20:04
<
companion_cube >
Arrays, tuples, lists, etc. work
20:19
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
20:25
mro has quit [Remote host closed the connection]
20:29
mro has joined #ocaml
20:31
<
neiluj >
awesome! thanks
20:31
<
neiluj >
just tried with arrays:)
20:31
<
neiluj >
yeah for instance you can't compare "functional values" such as Seq.t
20:32
waleee has quit [Ping timeout: 260 seconds]
20:33
<
neiluj >
but wait, the definition of a Seq.t is similar to that of a List.t
20:33
<
neiluj >
except Seq.t has that little +'a
20:33
<
neiluj >
instead of generic type 'a for list
20:39
motherfsck has quit [Ping timeout: 248 seconds]
20:47
<
zozozo >
neiluj: the thing that matters is the type definition, not the abstract type you see
20:47
rgrinberg has joined #ocaml
20:48
<
zozozo >
In the case of Seq.t, the type definition states that some sequences contain functions
20:49
<
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)
20:51
<
neiluj >
ah, hence the term closure
20:51
<
neiluj >
many thanks, this clears things up a lot
20:52
<
neiluj >
so comparing values whose types are abstract is not that dangerous
20:59
<
zozozo >
It's not dangerous but: 1) it can raise some exceptions 2) it can return false when you're expect true
20:59
<
companion_cube >
It's to avoid for types that are not, as one would say in other languages, "plain data"
21:01
neiluj has quit [Ping timeout: 248 seconds]
21:01
motherfsck has joined #ocaml
21:03
neiluj has joined #ocaml
21:09
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
21:20
Haudegen has quit [Quit: No Ping reply in 180 seconds.]
21:20
Haudegen has joined #ocaml
21:59
motherfsck has quit [Ping timeout: 260 seconds]
22:12
mro has quit [Quit: Leaving...]
22:16
olle has quit [Ping timeout: 264 seconds]
22:23
troydm has quit [Ping timeout: 246 seconds]
22:30
perrierjouet has joined #ocaml
22:58
bgs has quit [Remote host closed the connection]
23:17
bartholin has quit [Quit: Leaving]
23:17
Serpent7776 has quit [Ping timeout: 246 seconds]
23:39
xd1le has joined #ocaml
23:52
rgrinberg has joined #ocaml
23:57
neiluj has quit [Quit: WeeChat 3.6]