kaustuv changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | 3.11.1 out now! Get yours from http://caml.inria.fr/ocaml/release.html
komar_ has quit ["WeeChat 0.2.6.2-ohshi"]
pizza_ has joined #ocaml
pizza_ has left #ocaml []
julm has quit [Read error: 60 (Operation timed out)]
julm has joined #ocaml
yziquel has joined #ocaml
mbishop_ is now known as mbishop
ched_ has quit [Read error: 110 (Connection timed out)]
ched_ has joined #ocaml
jknick has quit ["leaving"]
Alpounet has quit ["Ex-Chat"]
AxleLonghorn has joined #ocaml
<AxleLonghorn> is there a clean way to read input?
<AxleLonghorn> the End_of_file exception is a pain
<AxleLonghorn> I mean, to read all of the input into a string/buffer
<julm> AxleLonghorn: Pervasives.input ?
<AxleLonghorn> I don't know how long the input is going to be
<julm> AxleLonghorn: Buffer.add_channel ?
<Associat0r> could anyone tell me some reasons of when it's better to use Classes instead of Polymophic Variants?
julm has quit [Read error: 110 (Connection timed out)]
julm has joined #ocaml
<AxleLonghorn> As taken from here: http://pauillac.inria.fr/~xleroy/talks/icfp99.ps.gz
<AxleLonghorn> classes are good when you need to rewrite code often
<palomer> Associat0r, never!
<palomer> just kidding
<Associat0r> AxleLonghorn: thanks I read that but that doc didn't address polymophic variants
<palomer> classes are good when you want the user to be able to add a variant
<Associat0r> palomer: can't polymorphic variants do the same?
<palomer> if I have a function foo -> bar, and foo is a variant, then the user will never be able to define his own foo
<palomer> and thus never be able to use the function
<palomer> let some_func x = x#meow
<palomer> I like the "bonus feature" slide
<Associat0r> palomer: are you sure we are talking about the same thing? http://caml.inria.fr/pub/docs/manual-ocaml/manual006.html#toc36
<Associat0r> palomer: open sum types instead of closed ones
<palomer> let some_func x = match x with `Foo -> bar () | _ -> baz ()
<palomer> so, in this case, the user can supply anything to some_func
<palomer> but anything else than a `Foo will call baz ()
<Associat0r> palomer: so what you say is the user can never specify which function get's called when supplying something orther than Foo
<AxleLonghorn> the idea is that any object passed to `some_func' will work as long as it has a `meow' method
<AxleLonghorn> http://pastebin.com/d51650268 Can anyone think of a way of avoiding the warning?
<Associat0r> AxleLonghorn: but can't you simulate that with polvar's and just supply a meow function along with it?
<julm> AxleLonghorn: you shouldn't put the try within [loop] because it removes the tail-recursion
<AxleLonghorn> julm: it isn't
<julm> oh sorry
<julm> I misread
<AxleLonghorn> Associat0r: that sounds right. To be honest, I've never used OCaml's objects
<AxleLonghorn> *for small values of never
<palomer> supply a meow function?
<palomer> If you want something extensible, you should use modules, objects or existential types
<palomer> actually, I'm not even sure about modules
<julm> AxleLonghorn: why this the need for this assert false? how the flow could possibly get there?
<julm> -this
<palomer> if I've built a whole bunch of stuff with type around some type A, and there's a huge library which uses type B, and A is a subtype of B, then I can use it. if A is a polymorphic variant type, then the library which uses B will only be able to recognize a finite number of the constructors. if A is an object type, B can simply call the methods of A
<julm> this removes the warning: try ignore (loop ()); assert false with End_of_file -> Buffer.contents str
<julm> or this: let rec loop () : unit =
jeddhaberstro has quit []
<Associat0r> palomer: so in which cases would you use polvars then?
bernardofpc has quit [hubbard.freenode.net irc.freenode.net]
Hadaka has quit [hubbard.freenode.net irc.freenode.net]
patronus has quit [hubbard.freenode.net irc.freenode.net]
tsuyoshi has quit [hubbard.freenode.net irc.freenode.net]
yziquel has quit [hubbard.freenode.net irc.freenode.net]
AxleLonghorn has quit [hubbard.freenode.net irc.freenode.net]
acatout has quit [hubbard.freenode.net irc.freenode.net]
AxleLonghorn has joined #ocaml
acatout has joined #ocaml
Hadaka has joined #ocaml
patronus has joined #ocaml
bernardofpc has joined #ocaml
tsuyoshi has joined #ocaml
ched_ has quit [hubbard.freenode.net irc.freenode.net]
svenl has quit [hubbard.freenode.net irc.freenode.net]
duper` has quit [hubbard.freenode.net irc.freenode.net]
prigaux has quit [hubbard.freenode.net irc.freenode.net]
Ori_B has quit [hubbard.freenode.net irc.freenode.net]
TaXules has quit [hubbard.freenode.net irc.freenode.net]
tarbo2 has quit [hubbard.freenode.net irc.freenode.net]
ertai has quit [hubbard.freenode.net irc.freenode.net]
mattam has quit [hubbard.freenode.net irc.freenode.net]
Demitar has quit [hubbard.freenode.net irc.freenode.net]
ched_ has joined #ocaml
svenl has joined #ocaml
tarbo2 has joined #ocaml
duper` has joined #ocaml
prigaux has joined #ocaml
TaXules has joined #ocaml
Ori_B has joined #ocaml
ertai has joined #ocaml
Demitar has joined #ocaml
mattam has joined #ocaml
spez has joined #ocaml
spez has quit [Client Quit]
willb has joined #ocaml
<AxleLonghorn> julm: thanks, that worked
<AxleLonghorn> julm: the assert false is there because the function should never reach that location. The OCaml std library uses assert false on branches that should never be run, and I believe the compiler compiles assert false differently from assert something_else.
spez has joined #ocaml
julm has quit [Excess Flood]
<palomer> Associat0r, there are a few cool uses for polymorphic variants
<palomer> for example, you can have a type A which is a supertype of both B and C, neither which is supertype of the other
<palomer> sometimes, it's just not worth putting a new datatype in your namespace
<palomer> (for example, when the datatype is _only_ used within a single function)
<palomer> another example is typeconv
<palomer> for example, batteries may have datatypes which did not have with sexplib
<palomer> thus I can't use sexp_of_foo
<palomer> with polymorphic variants, this problem goes away
<palomer> sometimes, even when you can use a generic variant like ('a,'b) either = Left of 'a | Right of 'b, it is better to use polymorphic variants because they are more descriptive
<palomer> need I go on?
<Associat0r> palomer: thanks I understand it better now
<Associat0r> I am looking at garrigue's stuff now
<palomer> wait, I'm not done!
<Associat0r> ok go on
<palomer> when automatically generating code (like in camlp4), it would be a pain (and polluting) to constantly define new datatypes
<palomer> ok, I'm done.
<Associat0r> palomer: do you know about case classes in Scala?
sgwizdak has quit [Remote closed the connection]
bernardofpc has quit [Remote closed the connection]
mfp has quit [Read error: 104 (Connection reset by peer)]
bernardofpc has joined #ocaml
hkBst has joined #ocaml
duper` has left #ocaml []
willb has quit [Read error: 60 (Operation timed out)]
spez has quit []
mfp has joined #ocaml
AxleLonghorn has left #ocaml []
ulfdoz has joined #ocaml
<palomer> Associat0r, nope
sgwizdak has joined #ocaml
ikaros has joined #ocaml
_zack has joined #ocaml
ulfdoz has quit [Read error: 110 (Connection timed out)]
hkBst has quit [Remote closed the connection]
_zack has quit ["Leaving."]
ikaros has quit ["Leave the magic to Houdini"]
bernardofpc has quit [Remote closed the connection]
bernardofpc has joined #ocaml
sgnb` has quit [Read error: 104 (Connection reset by peer)]
sgnb` has joined #ocaml
Camarade_Tux has joined #ocaml
_zack has joined #ocaml
johnnowak has joined #ocaml
Associat0r has quit []
Yoric[DT] has joined #ocaml
johnnowak has quit []
<Yoric[DT]> hi
rwmjones_ has quit [Read error: 113 (No route to host)]
julm has joined #ocaml
eevar2 has joined #ocaml
mishok13 has quit [Read error: 54 (Connection reset by peer)]
julm has quit [Excess Flood]
julm has joined #ocaml
Yoric[DT] has quit ["Ex-Chat"]
mishok13 has joined #ocaml
verte has joined #ocaml
Lomono has quit ["Don't even think about saying Candlejack or else you wi"]
rwmjones_ has joined #ocaml
julm has quit [Read error: 104 (Connection reset by peer)]
jeanbon has joined #ocaml
julm has joined #ocaml
youscef has joined #ocaml
komar_ has joined #ocaml
ikaros has joined #ocaml
Amorphous has quit [Read error: 110 (Connection timed out)]
Amorphous has joined #ocaml
Camarade_Tux_ has joined #ocaml
Camarade_Tux__ has joined #ocaml
Camarade_Tux has quit [Read error: 110 (Connection timed out)]
Camarade_Tux_ has quit [Read error: 110 (Connection timed out)]
hkBst has joined #ocaml
Lomono has joined #ocaml
Ori_B has quit [hubbard.freenode.net irc.freenode.net]
prigaux has quit [hubbard.freenode.net irc.freenode.net]
TaXules has quit [hubbard.freenode.net irc.freenode.net]
svenl has quit [hubbard.freenode.net irc.freenode.net]
tarbo2 has quit [hubbard.freenode.net irc.freenode.net]
ched_ has quit [hubbard.freenode.net irc.freenode.net]
ched_ has joined #ocaml
svenl has joined #ocaml
tarbo2 has joined #ocaml
prigaux has joined #ocaml
TaXules has joined #ocaml
Ori_B has joined #ocaml
Ori_B has quit [hubbard.freenode.net irc.freenode.net]
prigaux has quit [hubbard.freenode.net irc.freenode.net]
TaXules has quit [hubbard.freenode.net irc.freenode.net]
svenl has quit [hubbard.freenode.net irc.freenode.net]
tarbo2 has quit [hubbard.freenode.net irc.freenode.net]
ched_ has quit [hubbard.freenode.net irc.freenode.net]
ched_ has joined #ocaml
svenl has joined #ocaml
tarbo2 has joined #ocaml
prigaux has joined #ocaml
TaXules has joined #ocaml
Ori_B has joined #ocaml
guille_ has joined #ocaml
pantsd has joined #ocaml
LeCamarade|Away has quit [Read error: 110 (Connection timed out)]
pantsd has quit [Read error: 110 (Connection timed out)]
lutter has joined #ocaml
bombshelter13_ has joined #ocaml
willb has joined #ocaml
guille_ has quit [Read error: 110 (Connection timed out)]
Yoric has joined #ocaml
<Yoric> hi
rwmjones_ has quit [Remote closed the connection]
r0bby has quit [Client Quit]
r0bby has joined #ocaml
rwmjones_ has joined #ocaml
r0bby has quit [Read error: 104 (Connection reset by peer)]
r0bby has joined #ocaml
Associat0r has joined #ocaml
r0bby has quit [Read error: 54 (Connection reset by peer)]
r0bby has joined #ocaml
r0bby has quit [Read error: 104 (Connection reset by peer)]
r0bby has joined #ocaml
thelema has joined #ocaml
r0bby has quit [Client Quit]
r0bby has joined #ocaml
_andre has joined #ocaml
petchema has quit [Read error: 110 (Connection timed out)]
petchema has joined #ocaml
julm has quit [Connection timed out]
julm has joined #ocaml
spez has joined #ocaml
verte has quit ["q"]
ulfdoz has joined #ocaml
eevar2 has quit ["This computer has gone to sleep"]
Camarade_Tux__ is now known as Camararade_Tux
Camararade_Tux is now known as Camarade_Tux
_andre has quit ["leaving"]
jeddhaberstro has joined #ocaml
Yoric has quit [Remote closed the connection]
johnnowak has joined #ocaml
rjack has joined #ocaml
rjack has quit [Client Quit]
Yoric[DT] has joined #ocaml
_zack has quit ["Leaving."]
johnnowak has quit [Remote closed the connection]
komar_ has quit [Read error: 60 (Operation timed out)]
psnively has joined #ocaml
psnively has left #ocaml []
hcarty has quit [Read error: 104 (Connection reset by peer)]
rwmjones_ is now known as rwmjones_gone
Yoric[DT] has quit ["Ex-Chat"]
hcarty has joined #ocaml
Yoric[DT] has joined #ocaml
ulfdoz has quit [Read error: 110 (Connection timed out)]
Madars has joined #ocaml
rwmjones_gone has quit [Read error: 110 (Connection timed out)]
Yoric[DT] has quit ["Ex-Chat"]
Yoric[DT] has joined #ocaml
itewsh has joined #ocaml
julm has quit [Connection timed out]
julm has joined #ocaml
komar_ has joined #ocaml
Alpounet has joined #ocaml
itewsh has quit ["There are only 10 kinds of people: those who understand binary and those who don't"]
_zack has joined #ocaml
ikaros has quit [Read error: 110 (Connection timed out)]
komar_ has quit [Read error: 60 (Operation timed out)]
komar_ has joined #ocaml
Madars has quit [Read error: 110 (Connection timed out)]
lutter has quit [Read error: 104 (Connection reset by peer)]
lutter has joined #ocaml
lutter has quit [Client Quit]
lutter has joined #ocaml
jeddhaberstro has quit []
Asmadeus has quit [Read error: 110 (Connection timed out)]
pantsd has joined #ocaml
slash_ has joined #ocaml
lutter has quit ["Leaving."]
AlexyK_ has joined #ocaml
hkBst has quit [Read error: 104 (Connection reset by peer)]
AlexyK_ has quit ["Rooms • iPhone IRC Client • http://rooms.derflash.de"]
bombshelter13_ has quit []
_zack has quit ["Leaving."]
youscef has quit ["KVIrc 3.4.0 Virgo http://www.kvirc.net/"]
ikaros has joined #ocaml
ikaros has quit [Remote closed the connection]
gl has quit ["leaving"]
psnively has joined #ocaml
rwmjones_ has joined #ocaml
psnively has quit []
komar_ has quit [Read error: 54 (Connection reset by peer)]
komar_ has joined #ocaml
rwmjones_ has quit ["Leaving"]
slash_ has quit [Client Quit]
jeanbon has quit [Read error: 110 (Connection timed out)]
Camarade_Tux has quit [Read error: 110 (Connection timed out)]
Yoric[DT] has quit ["Ex-Chat"]
julm has quit [Read error: 113 (No route to host)]