Linktim has quit [Read error: 110 (Connection timed out)]
LordMetroid has joined #ocaml
guillem has joined #ocaml
Linktim has joined #ocaml
ppsmimou has joined #ocaml
smimou has quit [Read error: 104 (Connection reset by peer)]
smimou has joined #ocaml
smimou has quit ["bli"]
coucou747 has joined #ocaml
smimou has joined #ocaml
LordMetroid has quit ["Leaving"]
OChameau has joined #ocaml
Jedai has joined #ocaml
rwmjones has quit ["Closed connection"]
rwmjones has joined #ocaml
gim has joined #ocaml
Snark has joined #ocaml
vbmithr has left #ocaml []
Associat0r has joined #ocaml
Linktim_ has joined #ocaml
<Yoric[DT]>
Mmmhhh....
<Yoric[DT]>
Performance question
<Yoric[DT]>
In [match x with Bla _ as y -> y], I see that [y] doesn't have to have the same type as [x].
<Yoric[DT]>
Does this mean that [as y] will cause a copy ?
<Yoric[DT]>
Or that OCaml has produced some transparent type-cast?
<bluestorm>
copy is quite unlikely in a reference-passing world
l_a_m has joined #ocaml
<Yoric[DT]>
I'm just surprised by the fact that something which is a [match x with ... y -> y] produces an [y] with a type different from that of [x].
<Yoric[DT]>
I *guess* there's no copy.
Linktim has quit [Read error: 110 (Connection timed out)]
<bluestorm>
(function _ as y -> y) is 'a -> 'a
<bluestorm>
i'd say you're doing some polymorphic-variant white magic
pango- has joined #ocaml
<bluestorm>
and i'd except the strange behavior to be caused by the type system only, with no impact on the value representation
<Yoric[DT]>
Except I'm not using a polymorphic variant, just a regular sum type.
<Yoric[DT]>
Well, just surprised that some value may be an inhabitant of two distinct types without an Obj.magic...
<bluestorm>
hmm
pango has quit [Remote closed the connection]
pango- is now known as pango
rby has joined #ocaml
<Yoric[DT]>
Ok, patch for pa_monad contributed.
Associat0r has quit []
Associat0r has joined #ocaml
rwmjones_ has joined #ocaml
rwmjones has quit [Read error: 104 (Connection reset by peer)]
tomh has joined #ocaml
RobertFischer has joined #ocaml
RobertFischer has left #ocaml []
RobertFischer has joined #ocaml
seafood has quit [Connection reset by peer]
Associat0r has quit []
seafood has joined #ocaml
Associat0r has joined #ocaml
marmotine has joined #ocaml
<mfp>
<Yoric[DT]> In [match x with Bla _ as y -> y], I see that [y] doesn't have to have the same type as [x]. -> you're getting this without polymorphic variants??
<Yoric[DT]>
type ('a, 'b) either = Left of 'a | Right of 'b
<Yoric[DT]>
fun x -> match x with Left l -> assert false | Right _ as y -> y
<Yoric[DT]>
- : ('a, 'b) either -> ('c, 'b) either = <fun>
<mfp>
interesting
<mfp>
in the toplevel, the returned value is == to the original one
<Yoric[DT]>
Not for me.
<Yoric[DT]>
I just checked in my toplevel.
<Yoric[DT]>
(and with the compiler)
<Yoric[DT]>
3.10.1
<mfp>
3.10.2 here
<Yoric[DT]>
:/
<mfp>
also physical equality with ocamlopt
<Yoric[DT]>
Oh, you mean == .
<Yoric[DT]>
(I thought this was just a shortcut :))
<mfp>
yes, I really meant (==) :)
<Yoric[DT]>
:)
<Yoric[DT]>
Haven't tested that.
<Yoric[DT]>
It's good.
<Yoric[DT]>
Means that there's no copy.
<mfp>
but huh what where you testing then?
<mfp>
(since a == b implies a = b)
<Yoric[DT]>
I was only testing typing issues.
<Yoric[DT]>
Not physical equality.
<mfp>
ah, you meant that the type differed
<mfp>
I'm also seeing ('a, 'b) either -> ('c, 'b) either, with no copy
<mfp>
(neither in the toplevel nor with ocamlopt)
seafood has quit []
<Yoric[DT]>
All of this seems to mean that I can remove an optimization using Obj.magic from my code :)
seafood has joined #ocaml
Axioplase_ is now known as Axioplase
Associat0r has quit []
Associat0r has joined #ocaml
struk_atwork has joined #ocaml
struk_atwork is now known as structured
guillem has quit [Remote closed the connection]
<RobertFischer>
How do you convert a char into a string?
<Yoric[DT]>
In a weird manner.
<Yoric[DT]>
String.make your_char 1
<orbitz>
.create 1 chr
<orbitz>
it's raelly gay
<Yoric[DT]>
(iirc)
<RobertFischer>
Excellent.
<Yoric[DT]>
Ok, orbitz probably remembers better than I do.
<orbitz>
Yoric[DT]: i think both functinos exist
<Yoric[DT]>
It's less brain-dead with ExtLib.
<Yoric[DT]>
(String.of_char)
<orbitz>
yeah
<orbitz>
the OCaml stdlib String module is a real let down IMO
<RobertFischer>
orbitz: The standard library in general is a bit...sparse.
<RobertFischer>
But that's why we have ExtLib and Core. :-)
<bluestorm>
Extlib xor Core, actually
pango has quit [Remote closed the connection]
seafood has quit [Read error: 110 (Connection timed out)]
Linktim has joined #ocaml
pango has joined #ocaml
rby_ has joined #ocaml
rby has quit [Read error: 110 (Connection timed out)]
rby has joined #ocaml
Linktim_ has quit [Read error: 110 (Connection timed out)]
Linktim_ has joined #ocaml
Linktim has quit [Read error: 110 (Connection timed out)]
rwmjones_ has quit [clarke.freenode.net irc.freenode.net]
tsuyoshi has quit [clarke.freenode.net irc.freenode.net]
orbitz has quit [clarke.freenode.net irc.freenode.net]
svenl has quit [clarke.freenode.net irc.freenode.net]
cmeme has quit [clarke.freenode.net irc.freenode.net]
cmeme has joined #ocaml
orbitz has joined #ocaml
filp has quit ["Bye"]
rwmjones_ has joined #ocaml
tsuyoshi has joined #ocaml
svenl has joined #ocaml
rby_ has quit [Read error: 110 (Connection timed out)]