<palomer>
if I have a class type T, is it possible to add to it? (like <T;bar:int>)
thermoplyae has joined #ocaml
psnively has joined #ocaml
<palomer>
hrmph, I can't find a tutorial which explains the difference between val and method inside a class
<bluestorm_>
"val" is private, "method" is public
<bluestorm_>
in the sense that only the methods can caracterize an object from the outside
<palomer>
bluestorm_, private meaning accessible to any instance of the class
<palomer>
?
<bluestorm_>
hm
<bluestorm_>
no, only to the object
<palomer>
can method use mutable syntax?
<bluestorm_>
iirc they can't
<bluestorm_>
but you can store refs inside
<palomer>
which is pretty much the same thing?
<bluestorm_>
pretty much
<palomer>
is there a way to shorten type node_wrapper = <get_right_sibling: unit -> <to_node_wrapper: unit -> node_wrapper > option ;get_parent: unit -> <to_node_wrapper : unit -> node_wrapper> option> ?
<palomer>
it seems long and repetitive
<bluestorm_>
why don't you declare a class type instead ?
<palomer>
in ocaml, I have to use functions to compute, right? like, method rightSibling = !rightSiblingVal <--this wouldn't work, right?
<palomer>
I would have to type method rightSibling () = !rightSiblingVal
<bluestorm_>
hm
<bluestorm_>
the method call ( using the # thing ) is evaluated each time
<bluestorm_>
by doing so it behave a bit like an implicit unit -> foo functions
<bluestorm_>
(the idea is that you "send a message" to the object, each time)
<bluestorm_>
but palomer : do you really need your tree to be mutable ?
<bluestorm_>
from a fonctional p.o.v it seems that you could do with functional update only
<psnively>
==bluestorm_
<palomer>
hrmph
<palomer>
but there's a seek overhead
<palomer>
right?
<bluestorm_>
?
<bluestorm_>
wich seek overhead ?
<palomer>
if I use the zipper
<bluestorm_>
(and who cares about the overhead when writing code for the first time ?)
<palomer>
this is the second time
<palomer>
the first time was on haskell
<bluestorm_>
what's the first time like ?
<palomer>
works great
<palomer>
also uses ref
<bluestorm_>
blah
<psnively>
Use zippers.
<palomer>
advantages?
Morphous is now known as Amorphous
<bluestorm_>
palomer: there are no ref around :]
<bluestorm_>
and you have persistence for free
<bluestorm_>
hm
<psnively>
Advantages to zippers? Easier to reason about. Undo for free.
<psnively>
Maximal sharing.
<bluestorm_>
are we ocamlers really trying to explain the advantage of a purely functional data structure to a former haskeller ?
<psnively>
Functional, obviously.
<psnively>
I know... what's wrong with this picture?
<palomer>
undo for free??
<palomer>
really?
<psnively>
Sure: since you still have the previous "version" of the structure...
<palomer>
I actually tried to come up with my own zipper variant (before knowing about zippers)
<palomer>
and failed miserably
<palomer>
undo for free seems really interesting
<psnively>
One of the general benefits of purely functional data structures is "undo for free."
yangsx has joined #ocaml
<palomer>
oh, what the heck, I'll use zippers
<psnively>
Zippers are easy to implement in terms of delimited continuations. Now we just need Oleg to do native delimited continuations for native OCaml.
<bluestorm_>
psnively: in the case of a tree, wouldn't the usual current node * ancestors list do the job ?
<psnively>
Oh, I'm sure you could hack something together that would work well enough in the specific case, sure.
<palomer>
oleg does ocaml stuff?
<psnively>
Oleg does Scheme, OCaml, and Haskell simultaneously in a lot of cases.
<bluestorm_>
psnively: btw, what do you do ? :p
<palomer>
since I don't care about performance for now, shouldn't I use something simpler than zippers
<bluestorm_>
palomer: because zippers are not simple ?
prince has quit [Read error: 110 (Connection timed out)]
<thelema>
node_wrapper * node_wrapper list ?? A list with at least one element?
palomer has quit ["Leaving"]
middayc has quit []
wy has quit ["Leaving"]
palomer has joined #ocaml
wy has joined #ocaml
<palomer>
hrmph
<palomer>
what's the complexity of go_up for the zipper?
<adu>
i love zippers
seafood_ has joined #ocaml
seafood_ has quit [Read error: 110 (Connection timed out)]
adu has quit [Remote closed the connection]
wy has quit [Read error: 110 (Connection timed out)]
Mr_Awesome has quit [brown.freenode.net irc.freenode.net]
nuncanada has quit [brown.freenode.net irc.freenode.net]
det has quit [brown.freenode.net irc.freenode.net]
munga has quit [brown.freenode.net irc.freenode.net]
dibblego has quit [brown.freenode.net irc.freenode.net]
mattam has quit [brown.freenode.net irc.freenode.net]
bla has quit [brown.freenode.net irc.freenode.net]
fremo has quit [brown.freenode.net irc.freenode.net]
jdev has quit [brown.freenode.net irc.freenode.net]
zmdkrbou has quit [brown.freenode.net irc.freenode.net]
ertai has quit [brown.freenode.net irc.freenode.net]
thermoplyae has quit ["daddy's in space"]
zmdkrbou has joined #ocaml
ertai has joined #ocaml
fremo has joined #ocaml
mattam has joined #ocaml
Mr_Awesome has joined #ocaml
nuncanada has joined #ocaml
det has joined #ocaml
munga has joined #ocaml
dibblego has joined #ocaml
bla has joined #ocaml
jdev has joined #ocaml
jdev has quit [Connection reset by peer]
Mr_Awesome has quit [Read error: 104 (Connection reset by peer)]
det has quit [Success]
det has joined #ocaml
Mr_Awesome has joined #ocaml
jdev has joined #ocaml
mwc has quit [Remote closed the connection]
johnnowak has joined #ocaml
mwc has joined #ocaml
mwc has quit ["Leaving"]
filp has joined #ocaml
filp has quit [Read error: 104 (Connection reset by peer)]
l_a_m has joined #ocaml
prince has joined #ocaml
ita has joined #ocaml
seafood_ has joined #ocaml
ygrek has joined #ocaml
szell has quit [Read error: 110 (Connection timed out)]
yangsx has quit [Read error: 110 (Connection timed out)]
middayc has joined #ocaml
johnnowak has quit []
ygrek has quit [Remote closed the connection]
szell has joined #ocaml
Anarchos has joined #ocaml
<Anarchos>
i finally got my unix module compiling with shared libraries supported !
<bluestorm_>
congrats :p
<Anarchos>
anyway i had to add ../../byterun/ocamlrun to the list of exec/libs to be linked with. I don't like this idea since ocamlmklib should have already done that
<pippijn>
is there an ocaml eval irc bot?
<pippijn>
would it be a good idea to have one?
<pippijn>
I mean.. would it be useful?
schme has joined #ocaml
<tsuyoshi>
yeah there is one
<pippijn>
in here?
<tsuyoshi>
don't know if it's running right now.. let's try
<tsuyoshi>
0;;
<tsuyoshi>
guess not
<pippijn>
how does it protect itself from abuse?
<pippijn>
like calling syscalls it shouldn't
<tsuyoshi>
I think it has i/o etc. disabled
<pippijn>
how
<tsuyoshi>
I dunno.. you could remove all the dangerous stuff from the pervasives module
<tsuyoshi>
remove the unix module
<tsuyoshi>
that might be enough... or just run it in a chroot jail
seafood__ has joined #ocaml
<pippijn>
and it's impossible to do things like kill -9 -1
<pippijn>
in ocaml?
<tsuyoshi>
you mean kill -9 1?
<pippijn>
no, -1
<tsuyoshi>
what does that do
<pippijn>
kill all processes you own
<tsuyoshi>
ah
<tsuyoshi>
well like I said you could disable the unix module
<tsuyoshi>
that's where kill is
<pippijn>
and it's not possible to rewrite it?
<pippijn>
there is no such thing as "external C call" or inline asm?
<bluestorm_>
pippijn: the protection is done by overriding the dangerous modules
<tsuyoshi>
there are external c calls.. but you'd need the c code linked in