rwmjones changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | Grab Ocaml 3.10.2 from http://caml.inria.fr/ocaml/release.html (featuring new camlp4 and more!)
jargonjustin has quit []
umod has quit [Read error: 104 (Connection reset by peer)]
donny_ has joined #ocaml
jlouis_ has joined #ocaml
<fbvortex> If I try the code segment at: http://pastebin.com/m4f97bc7b , I get a syntax error and it seems related to the presence of the guard condition
<fbvortex> this is an example of what I was trying to get at with my earlier match question.
<fbvortex> is there something wrong in principle with the match in that code?
<thelema> only one 'when' clause per ->
<thelema> match x with cond1 | cond2 when test -> 1 -- OK
<thelema> match x with cond1 when test1 | cond2 when test2 -> 1 -- NOT OK
<fbvortex> thelema: OK, thanks.
Linktim has quit [Remote closed the connection]
jlouis has quit [Connection timed out]
jlouis_ is now known as jlouis
Tetsuo has quit ["Leaving"]
AxleLonghorn has quit ["Leaving."]
jlouis_ has joined #ocaml
jlouis has quit [Connection timed out]
eu-prleu-peupeu has joined #ocaml
<eu-prleu-peupeu> hey
<eu-prleu-peupeu> is OCaml better than Haskell ?
<hcarty> Yes!
<hcarty> Though, to be fair, the opinions in here may be rather biased
<hcarty> And better will likely depend on what you want to use it for
coucou747 has quit ["bye ca veut dire tchao en anglais"]
<thelema> eu-prleu-peupeu: is a spoon better than a fork?
<eu-prleu-peupeu> :D
<eu-prleu-peupeu> hehehe
<eu-prleu-peupeu> do you think OCaml will rule the world of computer languages ?
goalieca has joined #ocaml
<thelema> no, it's too difficult for an average/below-average programmer to use.
<thelema> :)
<eu-prleu-peupeu> that means that all OCaml coders are l33t ?
<thelema> no, just above average.
<eu-prleu-peupeu> ah ok
<hcarty> OCaml is less different from "other" languages (C, Java, etc) than Haskell, but still quite different
wy has quit [Read error: 110 (Connection timed out)]
rogo has joined #ocaml
eu-prleu-peupeu has left #ocaml []
Morphous has joined #ocaml
petchema has quit [Read error: 113 (No route to host)]
ita has quit [Remote closed the connection]
Amorphous has quit [Read error: 110 (Connection timed out)]
hkBst has quit ["Konversation terminated!"]
hasone_ has quit [Remote closed the connection]
ecc has quit ["leaving"]
wy has joined #ocaml
jlouis has joined #ocaml
jlouis_ has quit [Read error: 110 (Connection timed out)]
jlouis_ has joined #ocaml
jlouis has quit [Read error: 110 (Connection timed out)]
goalieca has quit [Remote closed the connection]
TheLittlePrince has joined #ocaml
TheLittlePrince has quit [Client Quit]
TheLittlePrince has joined #ocaml
jlouis has joined #ocaml
jlouis_ has quit [Read error: 110 (Connection timed out)]
a13x has joined #ocaml
<a13x> question: can you pass object members as function arguments?
__suri has joined #ocaml
<thelema> a13x: object members like values or methods?
<thelema> you can pass any ocaml value as a function argument, so encapsulating whatever you want as a functional value (to pass as argument) should work for any situation.
<a13x> what do you mean by "encapsulating"
<thelema> (fun arg -> obj#method arg)
<a13x> when would the method be executed?
<a13x> i have this: GMain.Timeout.add ~ms:100 ~callback:(fun _ -> (print_string "."; idle_func (); true)
<thelema> okay, every 100 ms idle_func gets called...
<a13x> for some reason it doen't work
<a13x> idle_func is a member
<thelema> does . get printed?
<a13x> yes but not the print statement inside idle_func
<thelema> idle_func is a member of what?
<a13x> member of another class
<thelema> do you have a function called idle_func as well?
<a13x> no
<a13x> class ui width height (brd:board) mode send_message_func request_rule_func change_rule_func (idle_func:unit->unit) =
<a13x> idle_func is passed when the object is created
<thelema> okay, idle_func is a parameter. What gets passed in when it's created?
<a13x> ui = new ui 1010 700 (new board 20 10 2 (fun _ _ _ ->())) ServerMode (fun _ -> ()) (fun _ _ _ _ -> ()) (fun _ _ _ _ _ -> ()) self#process_input;
<thelema> why are you subverting the GTK event handlers?
<a13x> subverting?
<thelema> yes, self#process_input every 100 ms?
<a13x> i need it to run something
<thelema> sounds like you're trying to bypass the way GTK handles events and build your own event handler.
<a13x> server app
<a13x> i thought that is how you implement timers
<thelema> but anyway... self#process_input takes () and returns () and isn't actually having an effect
<thelema> ?
<a13x> it does have an effect on the class
<thelema> butu it doesn't print?
<a13x> the first line of process_input is print
<a13x> then some code to process tcp sockets
<a13x> and the effect is on a socket list
<a13x> need the code?
<thelema> no... can you flush stdout immediately after the print?
<a13x> how do i do that?
<thelema> flush stdout;
<a13x> This expression has type Unix.file_descr but is here used with type
<a13x> out_channel
goalieca has joined #ocaml
<thelema> you may have to do flush (Unix.out_channel_of_descr channel)
<a13x> flush is part of Unix or something else?
<a13x> i have open Unix in the file
<thelema> flush is part of stdlib (Pervasives module)
<thelema> I expected a Unix.flush as well, but I don't find one.
<a13x> looks like stdout is of wrong time
<a13x> type
jlouis_ has joined #ocaml
<thelema> oops, there's a Unix.stdout.
<thelema> try flush Pervasives.stdout
<a13x> doesn't seem to flush
<thelema> compiles but doesn't work? your print there is just a print_string?
<a13x> the reason is because i put the flush inside process_input
<a13x> it doesn't get called at all
<thelema> (there = in self#process_input)
<a13x> when i close the prog i get .....................................
<thelema> from your callback.
<a13x> method process_input () =
<a13x> print_endline "polling for new data in sockets...";
<a13x> flush Pervasives.stdout;
<a13x> it seems it doesn't get called at all
<a13x> started server
<a13x> ..........................
<thelema> try wrapping the #process_input -- (fun () -> self#process_input ()) (as argument to creation of ui.
<a13x> that is the output
<a13x> same thing
<a13x> ui = new ui 1010 700 (new board 20 10 2 (fun _ _ _ ->())) ServerMode (fun _ -> ()) (fun _ _ _ _ -> ()) (fun _ _ _ _ _ -> ()) (fun _ -> self#process_input ());
<a13x> doesn't work
<thelema> a13x: I recommend using fun () when you mean () -- fun _ can hide type errors.
<a13x> oh, sorry
<thelema> just a tip for debugging.
<a13x> ui = new ui 1010 700 (new board 20 10 2 (fun _ _ _ ->())) ServerMode (fun _ -> ()) (fun _ _ _ _ -> ()) (fun _ _ _ _ _ -> ()) (fun () -> self#process_input ());
<a13x> still the same trail of dots
<a13x> when i close the program
<thelema> can you change your print_string "." to print_string "*" (to make sure the timeout is even being hit)?
<a13x> works perfectly
<thelema> now prints *'s, right?
<a13x> yes
<thelema> try (fun () -> print_char '@'; self#process_input ());
<a13x> where, in the second class?
<a13x> ui or server?
<thelema> in idle_func's slot.
<thelema> ui
<thelema> ui = new ui 1010 700 blah blah (fun () -> print_char '@'; self#process_input ());
<a13x> ui doesn't have function process_input
<a13x> i guess you mean server
<thelema> I guess so too.
<a13x> ui = new ui 1010 700 (new board 20 10 2 (fun _ _ _ ->())) ServerMode (fun _ -> ()) (fun _ _ _ _ -> ()) (fun _ _ _ _ _ -> ()) (fun () -> print_char '@'; self#process_input ());
<a13x> *************
<a13x> no @
jlouis has quit [Read error: 110 (Connection timed out)]
<thelema> okay, so what we pass in doesn't get called... anything else called idle_func?
<a13x> nothing else calls it
<thelema> anything else named idle_func?
<a13x> not in UI
<thelema> where's the GMain.Timeout.Add?
<a13x> in UI
<thelema> hmm... try renaming idle_func to idle_func2 (in both places)
<a13x> no i called idle_func outside timeout
<a13x> if mode==ServerMode then (GMain.Timeout.add ~ms:100 ~callback:(fun _ -> (print_string "*"; idle_func (); true)); ());
<a13x> idle_func ();
<a13x> it still doesn't get called
<a13x> maybe because it doesn't have access to an instance
<a13x> (of server)
<a13x> which it is a part of
<thelema> it doesn't need access to that - lexical scope takes care of that.
<thelema> even the print @ doesn't get called...
<thelema> somehow idle_func isn't the same idle_func, I think.
<thelema> try renaming.
<a13x> alright, lets see
<a13x> still the same output
<thelema> hmm...
<thelema> time for me to sleep. Good luck.
thelema is now known as thelema|away
<a13x> thanks a lot
adu has joined #ocaml
|Catch22| has quit []
<a13x> is there anyone alive
<adu> nope :)
pango_- is now known as pango
<a13x> i have a problem calling a function (which is a member of a class) which was passed to another class which is trying to call it
<a13x> the function (member) was passed
bzzbzz has joined #ocaml
wy has quit [Read error: 110 (Connection timed out)]
adu has quit [Remote closed the connection]
Linktim has joined #ocaml
goalieca_lappy has joined #ocaml
Yoric[DT] has joined #ocaml
<Yoric[DT]> hi
<a13x> hi
<a13x> i have a bit of a problem, care to help?
<Yoric[DT]> I can try.
<a13x> ok, great
<a13x> so, i have 2 classes
<a13x> UI and server
<a13x> i have the following call in ui
<a13x> i mean
<a13x> class ui width height (brd:board) mode send_message_func request_rule_func change_rule_func (idle_func2:unit->unit) =
<a13x> the following call in server
<a13x> ui = new ui 1010 700 (new board 20 10 2 (fun _ _ _ ->())) ServerMode (fun _ -> ()) (fun _ _ _ _ -> ()) (fun _ _ _ _ _ -> ()) (fun () -> print_char '@');
<a13x> notice idle_func2
<a13x> if mode==ServerMode then (GMain.Timeout.add ~ms:100 ~callback:(fun _ -> (idle_func2 (); true)); ());
<a13x> that previous line is in UI
<Yoric[DT]> If you wish to paste source, try using pastebin.com
<Yoric[DT]> That's easier to read.
<a13x> ok
jlouis has joined #ocaml
* Yoric[DT] notices idle_func2
<Yoric[DT]> I'll ask the usual question before carrying on: are you sure you need classes ?
<a13x> i am trying to call something in server
<a13x> i probably don't but all those OO classes had their effect
<Yoric[DT]> :)
<a13x> anyway, i suspect classes are causing the problem but i could be wrong
<a13x> the problem is idle_func2 never gets called
<a13x> (unless it is defined within that init function in UI
<Yoric[DT]> Is it normal that you have two definitions of field ui ?
<Yoric[DT]> One in "init", one before.
<Yoric[DT]> One of these has the print_char, the other doesn't.
ttamttam has joined #ocaml
<a13x> not sure what field you are referring to
<a13x> please be more specific
jlouis_ has quit [Read error: 110 (Connection timed out)]
<Yoric[DT]> line 16 of server
<Yoric[DT]> val mutable ui = new ui 1010 700 (new board 20 10 2 (fun _ _ _ ->())) ServerMode (fun _ -> ()) (fun _ _ _ _ -> ()) (fun _ _ _ _ _ -> ()) (fun _ -> ());
<Yoric[DT]> Is it normal that the last argument is a function which does nothing ?
<Yoric[DT]> Weren't you trying to have something printed ?
<Yoric[DT]> Side-note: writing init methods is usually not necessary in OCaml.
<Yoric[DT]> Since a class is essentially a function.
<a13x> alright
<a13x> this is like my second program in ocaml
<a13x> i have no idea what i am doing
<a13x> how would i pass a member function in initialization of that ui member?
<Yoric[DT]> Do you absolutely need initialization to happen at a stage later than construction ?
<a13x> there is a function called process_input
<a13x> that is what i am trying to run from UI
<a13x> i see now
<a13x> i used = instead of <-
<a13x> it seems to work now
<Yoric[DT]> Oh, yeah, that too :)
<a13x> but you are right, i shouldn't be using classes here
<Yoric[DT]> But I still don't understand why you have both line 16 and line 22.
<Yoric[DT]> Is that just for delaying initialization ?
ttamttam has left #ocaml []
goalieca has quit [""keep your stick on the ice""]
TheLittlePrince has quit [Read error: 113 (No route to host)]
<a13x> ok
<a13x> line 16: how do i use process_input in that last function
<a13x> like this
<a13x> val mutable ui = new ui 1010 700 (new board 20 10 2 (fun _ _ _ ->())) ServerMode (fun _ -> ()) (fun _ _ _ _ -> ()) (fun _ _ _ _ _ -> ()) (fun _ -> self#process_input);
<a13x> it tells me self cannot be accessed
<a13x> but i have to initialize ui to something
<Yoric[DT]> Try self:>server
<Yoric[DT]> instead of self.
<Yoric[DT]> If I understand correctly the error message, it's a typing problem : you can't just write "self" at that point because "self" doesn't have a type yet.
<Yoric[DT]> Note that you probably don't need "self" at all there.
<a13x> no, i do
<a13x> i will rewrite the thing without classes
<a13x> should help
<Yoric[DT]> ok
Tetsuo has joined #ocaml
goalieca_lappy has quit ["sleep"]
Demitar has quit ["Burn the land and boil the sea. You can't take the sky from me."]
Demitar has joined #ocaml
Demitar has quit [Read error: 104 (Connection reset by peer)]
Demitar has joined #ocaml
<flux> yoric[dt], maybe lazy evaluation could help
<flux> I mean a13x
<flux> .. = lazy (new ui ..) and later refer to ui with Lazy.force ui..
middayc____ has joined #ocaml
middayc____ is now known as middayc
middayc has quit [Client Quit]
middayc____ has joined #ocaml
middayc____ is now known as middayc
love-pingoo has joined #ocaml
coucou747 has joined #ocaml
a13x has quit [Read error: 113 (No route to host)]
benzo has quit [Read error: 104 (Connection reset by peer)]
LordMetroid has joined #ocaml
benzo has joined #ocaml
Linktim_ has joined #ocaml
Morphous is now known as Amorphous
Linktim has quit [Read error: 110 (Connection timed out)]
Linktim_ has quit [Read error: 110 (Connection timed out)]
Linktim_ has joined #ocaml
Linktim- has joined #ocaml
Linktim_ has quit [Read error: 110 (Connection timed out)]
Linktim- has quit [Read error: 110 (Connection timed out)]
gaja has joined #ocaml
marmottine has joined #ocaml
ben____ has joined #ocaml
ben____ is now known as ziph
Linktim- has joined #ocaml
middayc has quit []
Linktim- has quit [Read error: 110 (Connection timed out)]
middayc has joined #ocaml
Anarchos has joined #ocaml
zmdkrbou has quit [Read error: 113 (No route to host)]
bongy has joined #ocaml
Demitar has quit ["Burn the land and boil the sea. You can't take the sky from me."]
<Anarchos> when i try to do 'make world', i get "/bin/sh: -o: command not found" in otherlibs/unix . The command launch begins with "../../boot/ocamlrun ../../tools/ocamlmklib -oc unix accept.o access.o addrofstr.o alarm.o bind.o c ......"
middayc has quit []
Linktim- has joined #ocaml
dwmw2_gone is now known as dwmw2_GVA
ita has joined #ocaml
zmdkrbou has joined #ocaml
Linktim- has quit [Read error: 110 (Connection timed out)]
bluestorm has joined #ocaml
<Anarchos> is there someone awake here ?
<coucou747> yes
<Anarchos> coucou747 j'ai un prbm qd je recompile ocaml
<Smerdyakov> Anarchos, IRC etiquette suggests that you not ask that.
<Anarchos> Smerdyakov not to ask what ??
<coucou747> Anarchos> here, we speak english, join #ocaml-fr to speak french
<coucou747> Anarchos> il te demande de poser directement ta question, et de ne pas demander si tu peux la poser...
<Smerdyakov> Anarchos, not to ask if anyone is awake, or if anyone can answer a question, etc..
<Anarchos> coucou747 sorry i thought it was allowed. Let's do it in english thus
<coucou747> ok :)
<Anarchos> i can't build the unix library.
<Anarchos> the shell command is not accepted by sh : ./../boot/ocamlrun ../../tools/ocamlmklib -oc unix accept.o access.o addrofstr.o alarm.o bind.o c ......"
<Anarchos> i get "/bin/sh: -o: command not found"
middayc has joined #ocaml
dwmw2_GVA is now known as dwmw2_gone
bongy has quit ["Leaving"]
zenhacker_rouan has joined #ocaml
ofaurax has joined #ocaml
zenhacker_rouan has left #ocaml []
AxleLonghorn has joined #ocaml
Anarchos has quit ["Vision[0.8.5-0418]: i've been blurred!"]
Anarchos has joined #ocaml
ita has left #ocaml []
ttamttam has joined #ocaml
ttamttam has left #ocaml []
LordMetroid has quit ["Leaving"]
kotarak has joined #ocaml
Demitar has joined #ocaml
ttamttam has joined #ocaml
ttamttam has left #ocaml []
pango has quit [Remote closed the connection]
pango has joined #ocaml
Morphous has joined #ocaml
Amorphous has quit [Nick collision from services.]
Morphous is now known as amorphous
amorphous is now known as Amorphous
Anarchos has quit ["Vision[0.8.5-0418]: i've been blurred!"]
Madrok has left #ocaml []
kotarak has quit [":q!"]
hkBst has joined #ocaml
<thelema|away> does anyone know of a way to do the equivalent of "#include pa_macro1" in camlp4?
thelema|away is now known as thelema
shortcircuit has quit ["Probably rebooting."]
<bluestorm> thelema: at the camlp4-runtime level, "#load pa_macro1" should do the job
<bluestorm> hmm
__suri has quit []
<thelema> I'm interested in having that *inside* a .ml file.
<bluestorm> you mean, at compilation time ?
<Smerdyakov> thelema, the usual approach is to put the inclusion requests in a specially-formatted comment at the beginning of a file, with Makefile magic to interpret that.
<thelema> i.e. something outside camlp4 has to take care of determining what camlp4 engines get applied... :(
<bluestorm> why would camlp4 have to handle build system issues ?
<thelema> One advantage of cpp over camlp4 is that the instructions on how to process are inside the file being processed.
<bluestorm> i guess it would be feasible to create simple syntax extension, adding an e.g. #use_syntax directive, doing that
<bluestorm> but it seems that the solutions i've seen so far (ie. using a specific comment as Smerdyakov said) are better in term of adaptability
<Smerdyakov> That's the way Coq does it, and camlp4 was more or less invented to use to implement Coq. :-)
<thelema> would a camlp4 extension be able to load other extensions?
<bluestorm> hm
<bluestorm> if those extensions were specifically created for this, yes it would
<bluestorm> without any specific care, i think you'd have to use dynamic linking
<thelema> because camlp4 extensions are programs, and not just data for the camlp4 program to use in processing its input.
<bluestorm> yes but actually they're quite nealty packed into functors
<bluestorm> it would be quite a hack, but i think it might even be possible to do that without changing the extension code (by mimicking the camlp4 extension registration mechanism)
hsuh has joined #ocaml
* thelema puts that on his todo list
ofaurax has quit ["Leaving"]
kotarak has joined #ocaml
LordMetroid has joined #ocaml
ygrek has joined #ocaml
AxleLonghorn has left #ocaml []
|Catch22| has joined #ocaml
shortcircuit has joined #ocaml
coucou747 has quit ["bye ca veut dire tchao en anglais"]
bluestorm has quit ["Konversation terminated!"]
marmottine has quit [Remote closed the connection]
marmottine has joined #ocaml
middayc_ has joined #ocaml
evn has joined #ocaml
evn has quit [Remote closed the connection]
AxleLonghorn has joined #ocaml
middayc has quit [Read error: 110 (Connection timed out)]
middayc_ has quit []
middayc has joined #ocaml
ygrek has quit [Remote closed the connection]
ygrek has joined #ocaml
pango_ has quit [Remote closed the connection]
ita has joined #ocaml
middayc_ has joined #ocaml
evn has joined #ocaml
<neale> module Timer_set = Set.Make (struct type t = timer let compare = compare end)
<neale> type t = {timers: Timer_set.t ref}
<neale> and timer = (float * (t -> float -> int))
<neale> how can I do this?
middayc has quit [Read error: 110 (Connection timed out)]
<thelema> how can you do what?
<Smerdyakov> Tricky..
<Smerdyakov> No doubt there's a way to do it with recursive modules.
<thelema> module rec Timer = struct type t = {timers: Timer_set.t ref} type timer = float * (t -> float -> int) let compare = compare end and Timer_set = Set.make(Timer)
<neale> thelema: you just blew my mind
<thelema> neale: too much at once?
<thelema> does it work?
goalieca has joined #ocaml
coucou747 has joined #ocaml
<pango> I think signatures are a required for recursive modules... http://caml.inria.fr/pub/docs/manual-ocaml/manual021.html#s-recursive-modules
wy has joined #ocaml
<thelema> pango: it says "A typical example of a recursive module definition is: <code> It can be given the following specification: <code>" -- it doesn't seem required to give a spec.
<pango> not sure why it does work with signatures then, but the line you posted doesn't compile for me (syntax error)
<pango> (ocaml 3.10.0)
<thelema> pango: I more likely forgot a bit of syntax... maybe if I break it up across multiple lines properly
<thelema> ah, I typed "Set.make" instead of "Set.Make"
<pango> yes, I changed that
<thelema> still broken after that change?
<pango> yes
<pango> when the syntax error is reported, the first = (after module rec Timer) is underlined... that's one more reason why I thought signature was expected
<thelema> oh, you're right... I didn't look at the example enough...
<thelema> you have to specify the signatures for all recursive modules inline.
<thelema> module rec Timer : sig type t = {timers: Timer_set.t ref} type timer = float * (t -> float -> int) val compare : t -> t -> int end = struct type t = {timers: Timer_set.t ref} type timer = float * (t -> float -> int) let compare = compare end and Timer_set : Set.S with type elt=Timer.t = Set.Make(Timer)
<neale> you just blew my mind again
<pango> thelema: actually I wonder if that "restriction" is not something new in this experimental feature... will have to check in older revisions of the reference manual...
<neale> okay my daughter woke up but now I can try to put my mind back together
<thelema> it's just a huge block of unformatted code, 1/3 of chich repeats twice.
<thelema> pango: if you're doing recursive modules, it's probably good to give the type checker as much of a head start as possible.
<pango> thelema: yes, this restriction could have been added to "fix" some difficult cases... on the other hand, it could just be that my memory is faulty and that this restriction was there from the beginning...
Linktim has joined #ocaml
<pango> Objective Caml 3.07: Language features: - Experimental support for recursive module definitions module rec A : SIGA = StructA and B : SIGB = StructB and ...
<pango> (from changelog)
ziph has quit []
<thelema> yup, from the beginning the sigs are needed.
<neale> thelema: I have no idea what is happening there
coucou747 has quit ["bye ca veut dire tchao en anglais"]
<thelema> 4 pieces: the signauture of Timer, the struct of Timer, the sig of Timer_set, the struct of timer_set.
<neale> the signature of Timer_set is Set.S?
<thelema> Set.S with elt=Timer.t
<thelema> oops, Set.S with type elt=Timer.t
coucou747 has joined #ocaml
Linktim_ has joined #ocaml
evn has quit []
Linktim has quit [Read error: 110 (Connection timed out)]
ttamttam has joined #ocaml
ttamttam has left #ocaml []
Linktim_ has quit [Read error: 110 (Connection timed out)]
Yoric[DT] has quit [Read error: 113 (No route to host)]
Anarchos has joined #ocaml
<Anarchos> when i build dllunix.so, it doesn't link with libcamlrun. what did i miss in the makefiles ?
<thelema> Anarchos: what platform?
<Anarchos> hummm beos (sorry)
<thelema> Anarchos: ocamlrun doesn't do the linking, ocamlmklib does...
<Anarchos> thelema yes but it is not done !! i copied the options for mksharedlibs from the linux ones though
<thelema> your compile does the ocamlmklib -o unix (large list of .o files in unix directory)?
<thelema> (after compiling write.c)
ygrek has quit [Remote closed the connection]
<Anarchos> wait a minute i will copy the start of this line
<thelema> my compile goes:
<thelema> gcc -I../../byterun -O -fno-defer-pop -Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT -fPIC -c -o write.o write.c
<thelema> ../../boot/ocamlrun ../../tools/ocamlmklib -o unix accept.o access.o addrofstr.o alarm.o bind.o chdir.o
<thelema> (with lots more .o files)
<Anarchos> ../../boot/ocamlrun ../../tools/ocamlmklib -oc unix accept.o ....
<mbishop> Hmm, could you implement heterogeneous lists with records in Ocaml?
StoneNote has quit []
<thelema> mbishop: when you have your heterogenous list, and you get its head, how do you know what type the value has?
* mbishop shrugs
hsuh has quit [Read error: 110 (Connection timed out)]
<mbishop> that's why I was asking
<thelema> Anarchos: -oc vs -o... hmmm -o -> output, -oc -> output_c
<mbishop> :P
<flux> mbishop, with dynamic types
<thelema> mbishop: I don't think so. just use a variant type.
<thelema> Anarchos: -o <name> Generated Caml library is named <name>.cma or <name>.cmxa
<thelema> -oc <name> Generated C library is named dll<name>.so or lib<name>.a
<flux> mbishop, I did some trivial hacking a while back, perhaps this is of interest: http://www.modeemi.cs.tut.fi/~flux/software/ocaml/narrow.mli and .ml
<flux> but it uses Obj.magic :/
<flux> it might be possible to do without
<mbishop> I was wondering because someone on reddit was saying ocaml can't do heterogeneous types
<flux> I suppose that would require require weak hash tables or something that go in the background
<mbishop> in comparison with Ruby (haha oh wow)
<Anarchos> thelema i know : it is for supporting dynlink
<flux> well, it can't, lists are always sequences of a certain static type
<flux> you can simulate the effect, though
<mbishop> right, which is what I was asking heh, ways to simulate it
<thelema> Anarchos: that command fails, or that command doesn't produce the correct output
<thelema> mbishop: variant types are the right way to simulate heterogenous lists.
<flux> thelema, but it's not the same
<flux> thelema, you need to define the types of a variant type in one place
<mbishop> thelema: got an example?
<thelema> which is (more or less) what languages with a universal type basically do under the covers.
<thelema> flux: if you don't want to define types, use a polymorphic variant
<flux> thelema, yeah, I was thinking that, but I wonder how nicely you would implement that..
<flux> although I'd also like to see a case where one really wants to have such narrowed types in a list
<thelema> oops, n/m, you still have to define a nice type for the polymorphic variant, *and* do some casting...
a13x has joined #ocaml
<Anarchos> thelema why ? What is the problem ?
<flux> but then again, at times your design really calls for casting a child class back to a parent class, and doing that requires going through hoops in ocaml ;)
<thelema> Anarchos: two conversations going on here. my message to you should have been an either/or question.
<Anarchos> thelema ok sorry
<flux> any comments on narrow.ml{,i}, would anyone find it useful?-)
<mbishop> I mentioned that tuples allow for type mixing in a set or group or whatever the proper mathematical term is :P
<thelema> flux: casting to parent seems easy.
<thelema> mbishop: tuples allow for type mixing, as long as you know how many things you're mixing.
<flux> thelema, with objects? impossible, without a hash table that has an explicit mapping from child objects to parents?
<thelema> technically, tuples are just arrays where you're allowed to have different types within (and the type checker keeps track of those types)
<thelema> flux: (obj :> parent_type) ?
<flux> thelema, hrmh, obviosuly I meant the other way :-)
<thelema> feh. The other way can't be performed in general.
<flux> akin to a dynamic typing use case..
<thelema> if you have dynamic typing, you basically have a universal type, and *all* your objects are tagged.
<thelema> all your variables too.
<flux> yes, but the tagging is distributed
<thelema> even the number 3 gets tagged - as a number.
<flux> but I think narrow.ml gets quite close to the effect. it has explicit, dynamically allocated, tags
<flux> (and it overflows the counter too, so it won't work for long ;-))
<thelema> there's no syntactic overhead on the tagging, and the possibilities are built into the compiler (modulo composite types), but what do you mean by distribution?
<thelema> flux: just switch to a 128-bit counter -- that won't overflow.
<flux> let's say I wanted to have a universal type in ocaml
<flux> how would you write it?
<flux> ..now, how would you add record and object types to it..
<thelema> (not my work) http://ocaml.janestcapital.com/?q=node/18
<flux> I thought I had seen something related lately, but I didn't remember where..
marmottine has quit ["Quitte"]
Mr_Awesome has joined #ocaml
evn has joined #ocaml
thermoplyae has left #ocaml []
<flux> although the clean solution doesn't give 'a -> t, it gives close enough
a13x has quit [Read error: 113 (No route to host)]
hkBst has quit ["Konversation terminated!"]
ofaurax has joined #ocaml