Taaus changed the topic of #ocaml to: http://caml.inria.fr/oreilly-book/
<Etaoin> hi
<Taaus> Heya Shrdlu ;P
GnuVince has quit [Read error: 104 (Connection reset by peer)]
* Taaus wonders if Etaoin will see the connection...
GnuVince has joined #ocaml
<Etaoin> Taaus: yes. that's where I got this nick from
<Taaus> Umm... Where exactly? I know of several places where Etaoin Shrdlu appears... Although Douglas Hofstadter's Mathematical Themas is the only one that springs to mind right now... :)
GnuVince has quit [Client Quit]
<Etaoin> Taaus: I stumbled upon this: http://www.worldwidewords.org/weirdwords/ww-eta1.htm
GnuVince has joined #ocaml
GnuVince has left #ocaml []
<Taaus> Etaoin: Ah. :)
<Taaus> Hofstadter's book has a chapter on Winograd's AI system :)
<Etaoin> okay.
<Etaoin> so, what do ocaml people talk about?
<Taaus> Umm... Well, judging by the logs...
<Taaus> ... They talk about O'Caml... Go figure ;)
<Etaoin> not that I've seen in the last few hours
<Taaus> Ah, well... This channel is usually very, very quiet...
Etaoin has left #ocaml []
kjs3 has joined #ocaml
_kjs3 has joined #ocaml
kjs3 has quit [Read error: 110 (Connection timed out)]
_kjs3 has quit [Read error: 110 (Connection timed out)]
tmcm has joined #ocaml
<tmcm> hi
tmcm has quit ["using sirc version 2.211+ssfe"]
smklsmkl has joined #ocaml
smkl has quit [Remote closed the connection]
smklsmkl is now known as smkl
tav|peven has quit [carter.openprojects.net irc.openprojects.net]
johs has quit [carter.openprojects.net irc.openprojects.net]
smkl has quit [carter.openprojects.net irc.openprojects.net]
illume has quit [carter.openprojects.net irc.openprojects.net]
Taaus has quit [carter.openprojects.net irc.openprojects.net]
skylan has quit [carter.openprojects.net irc.openprojects.net]
johs has joined #ocaml
Taaus has joined #ocaml
smkl has joined #ocaml
illume has joined #ocaml
tav|peven has joined #ocaml
tav|peven has quit [Excess Flood]
skylan has joined #ocaml
tav` has joined #ocaml
skylan has quit [carter.openprojects.net irc.openprojects.net]
skylan has joined #ocaml
mellum has joined #ocaml
Demitar has joined #ocaml
<Demitar> Anyone alive?
<smkl> i am ...
<Demitar> Can I define a class which returns a type where one of the possible types is itself?
<Demitar> Such as:
<Demitar> type dbvalue = Database of database | String of string | Binary of binary
<Demitar> class virtual database =
<Demitar> object
<Demitar> method virtual get : path -> dbvalue
<smkl> try: type 'db dbvalue = Database of 'db | ... and then class type database = object ('c) method get : path -> 'c dbvalue end
<Demitar> yikes. :)
<smkl> actually it depends on if you want the interface "database" to be extensible in the type "dbvalue"
<Demitar> Hmm... does using class type rather than only class mean I don't need to subtype explicitly?
<smkl> if you want it to be always same then you can use: type dbvalue = Database of db | String of string | Binary of binary and db = < get : path -> dbvalue >
<smkl> Demitar: no, it just means that it is an interface
<Demitar> Well database has ~10 functions atm....
<smkl> you don't have to use class type. but then you need to write object (self:'c) etc.
<Demitar> Ok.
<smkl> if you want the second alternative, then you would have to add all fields to the "db" type and make sure your class has type "db". it is also possible to parameterize "dbvalue" but instead of 'c just use "database"
<Demitar> Unbound class
<Demitar> database
<Demitar> I'm using database as top of the inheritance so I guess I'd like it as simple as possible
<Demitar> hrm...
<Demitar> Well now I have another problem...
<Demitar> type dbvalue = Database of database | String of string | Binary of binary and
<Demitar> database = < get : path -> dbvalue; close : unit; rm : path -> unit; mkd : path -> database; mks : path -> string; mkb : path -> binary; fields : fields; .. >
<Demitar> Unbound type parameter <..>
<smkl> you cannot put .. there, it's supposed to be non-extendable
<Demitar> How does constraint work? Can I use it to say I want to implement an interface in my class?
<Demitar> Ahm.. I don't need to do that at all I guess.
<Demitar> But that would mean I'd have to give type constraints on all functions since I cannot inherit...
<smkl> you can use contraint for that, but you could just have class a : interf = ... constraint is usually used for the class parameters
<smkl> you need to decide if you want your inherited classes to return Database with their own extended type or the original restricted type
<smkl> if you want the restricted type then you'll always need to do Database (self :> database)
<Demitar> whee, think I've got it all compiling now :)
<Demitar> What introspection capabilities does ocaml have?
malc has joined #ocaml
<smkl> Demitar: none
Demitar has quit [Read error: 104 (Connection reset by peer)]
Yurik has joined #ocaml
Yurik has quit [Read error: 104 (Connection reset by peer)]
Yurik has joined #ocaml
gl has joined #ocaml
malc has quit ["no reason"]
gl has quit [carter.openprojects.net irc.openprojects.net]
gl has joined #ocaml
graydon has joined #ocaml
gl has quit ["La foule est une somme d'erreurs qu'il faut corriger"]
Yurik has quit ["Client Exiting"]
graydon has left #ocaml []
mellum has quit ["Leaving"]
Demitar has joined #ocaml
jao has joined #ocaml
jao_ has joined #ocaml
jao has quit [Read error: 104 (Connection reset by peer)]
jao_ is now known as jao
Demitar has quit ["STAGE is a big maze with lots of corridors and traps, not understandable by mere mortals! (credits to Aglanor)"]
malc has joined #ocaml
<johs> I'm a bit confused. When an object is "- : Gtk.widget Gtk.obj = <abstr>", what does it mean?
<malc> this is the result of..?
<johs> Of a coercion. Let's see.
<johs> method as_widget = (obj :> Gtk.widget obj)
<johs> That is, I have a GWindow.window-object in which I call the as_widget-method.
<johs> Hm, no, I think I got it.
<johs> Never mind.
<malc> ok, i wont. had more than enough gtk for myself today
<johs> I'm just not entirely used to OCaml syntax yet.