cjeris changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/
mbishop has quit ["Leaving"]
joshcryer has quit [Client Quit]
bzzbzz has joined #ocaml
dbueno has joined #ocaml
Z4rd0Z has joined #ocaml
<dbueno> There is no way to "evaluate an expression in the current environment" in ocamldebug?
<dbueno> I mean an expression beyond printing a variable, or accessing a record field.
<dbueno> I have a particular kind of Map.Make(MyKeyHashedType) that I would like to print out in the debugger.
Go4005 has quit ["Leaving."]
dbueno has quit ["This computer has gone to sleep"]
mbishop has joined #ocaml
malc_ has quit ["leaving"]
jacobian has quit [Read error: 60 (Operation timed out)]
dbueno has joined #ocaml
dbueno has quit [Client Quit]
shawn has joined #ocaml
pants1 has joined #ocaml
Smerdyakov has quit ["Leaving"]
natali1 has joined #ocaml
<natali1> can someone IM me?
<natali1> why this room is so silent? I think that I should understand more about IRC, can anyone tell me sometips?
<natali1> this room is probably dead, I should search other way to find someone to chat with
natali1 has left #ocaml []
<flux-> :)
<flux-> good morning
shawn has quit [Read error: 60 (Operation timed out)]
benny has joined #ocaml
benny_ has quit [Read error: 110 (Connection timed out)]
smimou has joined #ocaml
shawn has joined #ocaml
love-pingoo has joined #ocaml
<love-pingoo> does anybody know what the C function "resize_extern_block" is used for in OCaml
<love-pingoo> ?
<love-pingoo> I saw its code, it has a failwith("Marshall ...") which is weird, 'cause I don't use marshalling at all
Z4rd0Z has quit []
smimou has quit ["bli"]
Submarine has quit ["Leaving"]
Ai_Itai has quit ["Leaving"]
<G> flux-: any idea if/when scaml is going to be updated?
<flux-> no idea
cmvjk has quit [Read error: 110 (Connection timed out)]
shawn has quit [Remote closed the connection]
<love-pingoo> G: ocaml 3.10 beta was released a while ago
<love-pingoo> 3.10 should come soon, I guess
<G> love-pingoo: I was talking about scaml (the patch for shared/dynamic linking)
<G> but thanks for the info, will keep an eye out
<love-pingoo> aah, sorry
<G> love-pingoo: my fault kinda, the question came from a discussion 1-2 days ago
mikeX has joined #ocaml
<mrvn> Debs are in the svn id you have debian
<mrvn> s/id/if/
Z4rd0Z has joined #ocaml
ppsmimram is now known as ppsmimou
<flux-> for me the native stack traces are the most interesting feature
Smerdyakov has joined #ocaml
lmbdwr has joined #ocaml
<lmbdwr> hello
<mrvn> hi
<mrvn> class base = object method m = () end
<mrvn> class foo = object inherit base method m = Printf.printf "foo\n" end
<mrvn> class bar = object inherit base method m = Printf.printf "bar\n" end
<mrvn> let foo = new foo
<mrvn> let bar = new bar
<mrvn> let l = foo::bar::[]
<mrvn> List.iter (fun o -> o#m) l;;
<mrvn> val l : foo list = [<obj>; <obj>]
<mrvn> Why is that a foo list and not a base list?
<mrvn> And how would you do the same without classes?
<Smerdyakov> Wow, that's wild.
<Smerdyakov> I wouldn't have thought that that code would even type-check.
<Smerdyakov> Oh, wait. I'm thinking Java too much.
<Smerdyakov> foo and bar are the same type.
<Smerdyakov> It's structural equivalence that matters, not names.
<Smerdyakov> You get foo instead of bar because of arbitrary unification order.
<Smerdyakov> And what is "the same"?
<mrvn> Yeah, if I add more methods to the example I need to use this: let l = (foo:>base)::(bar:>base)::[]
<mrvn> Smerdyakov: I have a bunch of objects that share a common set of functions. Now I need to make a list of those so That I can call any of the common functions on them.
<Smerdyakov> And you ask how to do that without classes?
<mrvn> yep.
<mrvn> I can do this: type base = { m : unit -> unit; }
<mrvn> type foo = { s : string; }
<mrvn> let foo = { s = "foo"; }
<mrvn> let foo_base = { m = fun () -> Printf.printf "%s\n" foo.s; }
<mrvn> But then I need to create one foo_base for every single foo object in turn. That eats memory.
<Smerdyakov> Yes, you can use records to do a lot of that kind of thing completely naturally.
<Smerdyakov> You think objects in OCaml don't eat the same memory?
<mrvn> objects have a common virtual table for all instances of that type I believe.
<Smerdyakov> Oh, OK.
<Smerdyakov> No reason a compiler can't do the same with records.
<mrvn> type 'a virt = { m : 'a -> unit }
<mrvn> type 'a base = {
<mrvn> obj : 'a;
<mrvn> virt : 'a virt;
<mrvn> }
<mrvn> If I do that I can use a common function table. But I can't put "foo base" and "bar base" into a list
<mrvn> I think I have to define a function ''a -> 'a virt -> unit -> base', apply it to 'a and 'a virt and store that. And then on every use apply (), which creates a temporary record base so I can call a function. But that sounds inefficient.
dbueno has joined #ocaml
<flux-> sml partially (?) solves issues oo solves in ocaml by record field inference
<Smerdyakov> You really want a MLton-style whole-program analysis which lets you get good performance from the default, natural implementation. :)
<dbueno> Would someone point me to a paper/website with functor evangelism? I'm wondering the current thoughts on in what sense functors are better than modules with "fully" polymorphic types.
<mrvn> I don't so much care about performance but memory is a concern i have.
<Smerdyakov> dbueno, I don't understand this 'modules with "fully" polymorphic types."
<mrvn> dbueno: how do you write a map type as module?
<dbueno> Smerdyakov, mrvn: Like the Map in the standard ocaml library v. PMap from extlib.
<dbueno> PMap is a ('a, 'b) t -- it makes keys of type 'a to values of type 'b.
<Smerdyakov> dbueno, have a link to a description of the 2nd?
<Smerdyakov> dbueno, that is implemented outside of OCaml, right?
<dbueno> You don't need a functor to specify the key type.
<dbueno> Smerdyakov, correct, it's not in the standard library.
<Smerdyakov> I can guarantee you that PMap isn't implemented in OCaml.
<mrvn> dbueno: Map is a data structure that holds a unique set of objects of a sortable type.
<Smerdyakov> I mean that you can't write an OCaml implementation, not that it isn't included with the base distribution.
<flux-> why not? the create-function gives the comparison function
<dbueno> Smerdyakov, unless we're talking about something different, the link I sent you is the API for one such implementation.
<Smerdyakov> I should probably have said without using bullshit functions like that.
<Smerdyakov> Ad-hoc generic garbage.
<flux-> well, most cases you can just use 'compare'
<flux-> (right?)
Ai_Itai has joined #ocaml
<dbueno> flux-, I mostly *don't* use `compare'
<Smerdyakov> Why to prefer functors? Because arbitrarily picking to support a polymorphic comparison function (written in C) is bad language design, and PMap depends on having it.
<flux-> dbueno, oh, well maybe it's just me, I use maps most often as associative tables
<dbueno> flux-, me too, but my keys are complicated enough to need non-standard comparator functions.
<Smerdyakov> Not to mention that sometimes you want to use the same type with different sets of supporting methods.
<flux-> the resulting code using it is bigger, though. and I'm not convenienced it's any clearer either.
<flux-> "IdSet.this IdSet.that, yes, I know it's an IdSet, let's get on with it already!" ;-)
<dbueno> Smerdyakov: Do you know of any papers/studies on the subject?
<mrvn> Smerdyakov: PMap seems to use a ('a -> 'a -> int) to compare, not C code.
<dbueno> mrvn, I was confused by that comment too, but I think he was referring to Pervasives.compare, which is implemented in C.
<mrvn> Smerdyakov: What is the difference between Hashtbl and Map beside Map being a functor?
<Smerdyakov> Hashtbl is ephemeral and Map is persistent.
<mrvn> ephemeral?
<Smerdyakov> mrvn, oh, I see. My bad.
<mrvn> mutable?
<Smerdyakov> Yes
<Smerdyakov> With runtime passing of comparison functions, you get inability of the type system to enforce that maps used as arguments to the same function use the same comparator, for instance.
<mrvn> Which is required for compare and equal I guess.
<mrvn> Comparing two maps for equality if one sorts key ascending and the other descending would be difficult.
<dbueno> Smerdyakov: That's a good point.
<mrvn> Is there a module that can give me an unique hash for an object and cans store/retrieve that object?
<Smerdyakov> Unique hash? If you're going to 32 bits, that's not going to happen!
<mrvn> Currently I use "let id = ref 0" as key for a Hashtbl.t and increment that for every stored obejct. But that can overflow.
<mrvn> Only needs to be unique for stored objects.
<Smerdyakov> That's not a hash. It's a separate indexing scheme.
<mrvn> I will add a check if the id is already in the hashtbl and then skip it.
<flux-> mrvn, I use Int64.t ;)
<Smerdyakov> How can you sleep at night, using boxed integer types??
<flux-> I sleep fine, thank you very much :)
dbueno has quit ["This computer has gone to sleep"]
<mrvn> flux-: Little difference between 63 and 64bit ints.
<mrvn> Smerdyakov: boxing is a const factor. quite irelevant. :)
<Smerdyakov> Maybe to you, wise guy.
smimou has joined #ocaml
love-pingoo has quit ["Leaving"]
ulfdoz has quit ["b0rked"]
ulfdoz has joined #ocaml
pangon8 has quit [Remote closed the connection]
code-janitor is now known as descender
pangon8 has joined #ocaml
descender is now known as code-converter
asymptote has joined #ocaml
asymptote has quit ["Leaving"]
eradman has quit [Remote closed the connection]
Submarine has joined #ocaml
Smerdy has joined #ocaml
Smerdyakov has quit [Read error: 54 (Connection reset by peer)]
Smerdy is now known as Smerdyakov
love-pingoo has joined #ocaml
eradman has joined #ocaml
gim has joined #ocaml
trisiak has quit [Read error: 104 (Connection reset by peer)]
Mr_Awesome has joined #ocaml
slipstream has joined #ocaml
nuncanada has joined #ocaml
vital303 has joined #ocaml
slipstream-- has quit [Read error: 110 (Connection timed out)]
pangon8 is now known as pango
seoushi has joined #ocaml
Submarine has quit ["Leaving"]
vital303 has left #ocaml []
G has quit [Connection timed out]
malc_ has joined #ocaml
G has joined #ocaml
tsuyoshi has quit [Remote closed the connection]
gim has quit [Operation timed out]
gim has joined #ocaml
nuncanada has quit ["Leaving"]
tsuyoshi has joined #ocaml
shawn has joined #ocaml
love-pingoo has quit ["Connection reset by pear"]
Z4rd0Z has quit []
mnemonic has joined #ocaml
<mnemonic> hi
david_koontz has joined #ocaml
postalchris has joined #ocaml
smimou has quit ["bli"]
mnemonic has quit ["leaving"]
postalchris has quit [Read error: 110 (Connection timed out)]
postalchris has joined #ocaml
malc_ has quit ["leaving"]
postalchris has quit [Read error: 113 (No route to host)]
gim has quit ["dodo"]