flux changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 4.00.1 http://bit.ly/UHeZyT | http://www.ocaml.org | Public logs at http://tunes.org/~nef/logs/ocaml/
emmanuelux has joined #ocaml
travisbrady has joined #ocaml
ollehar has joined #ocaml
eikke has quit [Ping timeout: 240 seconds]
gnuvince has quit [Remote host closed the connection]
gnuvince has joined #ocaml
gnuvince has quit [Remote host closed the connection]
gnuvince has joined #ocaml
justdit has joined #ocaml
walter has joined #ocaml
osa1 has quit [Quit: Konversation terminated!]
ontologiae has quit [Ping timeout: 260 seconds]
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
madroach has quit [Ping timeout: 248 seconds]
walter has quit [Quit: This computer has gone to sleep]
walter has joined #ocaml
madroach has joined #ocaml
q66 has quit [Quit: Leaving]
walter has quit [Quit: This computer has gone to sleep]
ollehar has quit [Ping timeout: 245 seconds]
Neros_ has quit [Ping timeout: 276 seconds]
introom has joined #ocaml
csakatoku has joined #ocaml
travisbrady has quit [Quit: travisbrady]
Drup has quit [Quit: Leaving.]
emmanuelux has quit [Quit: emmanuelux]
osnr has quit [Quit: Leaving.]
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
mattrepl has quit [Quit: mattrepl]
osnr has quit [Quit: Leaving.]
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
osnr has quit [Quit: Leaving.]
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
cdidd has quit [Remote host closed the connection]
justdit has quit [Quit: Lost terminal]
f[x] has joined #ocaml
breakds has quit [Quit: Konversation terminated!]
introom has quit [Remote host closed the connection]
csakatoku has quit [Remote host closed the connection]
gnuvince has quit [Remote host closed the connection]
gnuvince has joined #ocaml
osnr has quit [Quit: Leaving.]
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
osnr has quit [Quit: Leaving.]
csakatoku has joined #ocaml
csakatok_ has joined #ocaml
csakatoku has quit [Read error: Connection reset by peer]
introom has joined #ocaml
walter has joined #ocaml
gnuvince has quit [Remote host closed the connection]
weie has quit [Read error: Connection reset by peer]
weie has joined #ocaml
gnuvince has joined #ocaml
darkf_ has joined #ocaml
darkf has quit [Disconnected by services]
darkf_ is now known as darkf
mattrepl has joined #ocaml
ben_zen has joined #ocaml
walter has quit [Quit: This computer has gone to sleep]
walter has joined #ocaml
walter has quit [Quit: This computer has gone to sleep]
cdidd has joined #ocaml
alang_ has quit [Ping timeout: 246 seconds]
yezariaely has joined #ocaml
yezariaely has left #ocaml []
yezariaely has joined #ocaml
Simn has joined #ocaml
ttamttam1 has joined #ocaml
ttamttam1 has left #ocaml []
ttamttam1 has joined #ocaml
ben_zen has quit [Ping timeout: 264 seconds]
<yezariaely> Anyone can help me with inner modules? http://pastebin.com/C0Kp0EZ7
<yezariaely> my signature is not compatible and I have no clue why.
mattrepl has quit [Quit: mattrepl]
<gasche> yezariaely: your signature says that you provide the *module type* Inner
<gasche> (which is implemented by : module type Inner = sig ... end)
<gasche> what you want to say is that you provide a module with signature ..., so "module Inner : sig ... end"
<yezariaely> yeah just disovered that.
<yezariaely> however I didn't get it.
<yezariaely> ah
<yezariaely> damn it
<yezariaely> I have to provide a module TYPE "Inner" if I right it like that?
<yezariaely> argh...
<yezariaely> write not right ^^
<gasche> types, exceptions, values, can be component of modules
<gasche> modules can also be (so you have a submodule), but module *types* (signatures) can also be components of modules
<gasche> for example the Map module of the standard library provides the Map.S signature
<yezariaely> yeah now I understand.
<yezariaely> thanks!
<gasche> you're welcome
<gasche> (//me going back to non-computer stuff)
walter has joined #ocaml
ggole has joined #ocaml
xavierm02 has joined #ocaml
<xavierm02> Hey
Zeev has quit [Read error: Connection reset by peer]
<xavierm02> I'm trying to represent "mathematical sets" in ocaml
<xavierm02> so they would have a type etc.
<xavierm02> but if I asked for the union set of {0,1,2} as Z/3Z and {0,1} as Z/2Z, I would like the resulting set to have 5 elements.
<xavierm02> To ensure that that, I want to ask that the two sets are subsets of the SAME set
<xavierm02> so I have this:
<xavierm02> class ['a] union_set set1 set2 = object(self) inherit ['a] set if set1.superset <> set2.superset then failwith "The two sets given to union_set must be subsets of the same set." else (); val set1 : 'a set = set1 val set2 : 'a set = set2 method contains = fun x -> (set1#contains x) || (set2#contains x) end ;;
<xavierm02> hm
<xavierm02> I'll put it on pastebin
<xavierm02> but apparently, I'm not allowed to use a if in there.
snarkyboojum_ has quit [Ping timeout: 260 seconds]
walter has quit [Quit: This computer has gone to sleep]
srcerer_ has joined #ocaml
ivan\ has quit [Ping timeout: 264 seconds]
<xavierm02> never mind
<ggole> xavierm02: if you have invariants to enforce, put them between the argument list and the object definition
<xavierm02> I just needed to move it to the end and add the initializer
<xavierm02> hm
<xavierm02> so not in the initializer?
ivan\ has joined #ocaml
srcerer has quit [Ping timeout: 264 seconds]
introom has quit [Remote host closed the connection]
<ggole> Something like class foo arg = let _ = enforce arg in object ... end
<xavierm02> like that?
<xavierm02> ggole
Yoric has joined #ocaml
<ggole> Yes, I think so
<xavierm02> okay ty :)
hyperbor1ean is now known as hyperboreean
mye has joined #ocaml
walter has joined #ocaml
walter has quit [Client Quit]
osa1 has joined #ocaml
pygmalion has joined #ocaml
csakatok_ has quit [Remote host closed the connection]
pygmalion has quit [Ping timeout: 256 seconds]
eikke has joined #ocaml
introom has joined #ocaml
Arsenik has joined #ocaml
tane has joined #ocaml
tane has quit [Quit: Verlassend]
pygmalion has joined #ocaml
zpe has joined #ocaml
pygmalion has quit [Ping timeout: 264 seconds]
Neros has joined #ocaml
Drup has joined #ocaml
zxqdms has joined #ocaml
q66 has joined #ocaml
Arsenik has quit [Read error: Operation timed out]
Arsenik has joined #ocaml
bholst_ is now known as bholst
ollehar has joined #ocaml
eikke has quit [Ping timeout: 264 seconds]
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
Zeev has joined #ocaml
pygmalion has joined #ocaml
f[x] has quit [Ping timeout: 256 seconds]
pygmalion has quit [Ping timeout: 260 seconds]
<xavierm02> Okay I have a problem. I want to define a set as an object with: - a type - a function that takes something of this type and returns a boolean telling you whether it is in the set or not
<xavierm02> But then I define subsets because I want to allow union, intersection etc. only on two subsets of the same set
<xavierm02> But then there are some sets that are kind of "initial": they aren't subsets of anything but them selves.
<xavierm02> But when I try to put themselves as superset in the constructor, I get "Error: The instance variable self cannot be accessed from the definition of another instance variable"
Zeev has left #ocaml []
<xavierm02> hm
<xavierm02> I might have found a solution
<xavierm02> get a function get_superset instead of a field
tane has joined #ocaml
<xavierm02> Nope. Self type cannot be unified with a closed object type
<xavierm02> -.-
cthuluh has quit [Read error: Operation timed out]
<xavierm02> got it
dsheets has joined #ocaml
<xavierm02> made superset mutablet
<xavierm02> and user the initializer
<xavierm02> It'd be great if I could remove the option though
<xavierm02> But I wouldn't know what to put as initial value
<xavierm02> and making the superset non-mutable
<xavierm02> I guess I could put the get_superset back
<xavierm02> and hide superset with a signature
cthuluh has joined #ocaml
zpe has quit [Remote host closed the connection]
<xavierm02> Error: This expression has type < contains : 'a -> bool; get_superset : unit -> 'a set option; string_of_element : 'a -> string; .. > but an expression was expected of type 'a set Self type cannot be unified with a closed object type
<xavierm02> damn >_<
<xavierm02> nm, used :>
<xavierm02> Here's the "final" code in case someone has a few secs to look at it http://pastebin.com/0vDQhUXa
cthuluh has quit [Ping timeout: 245 seconds]
cthuluh has joined #ocaml
ollehar has quit [Ping timeout: 245 seconds]
q66 has quit [Quit: Leaving]
ollehar has joined #ocaml
q66 has joined #ocaml
q66 has quit [Client Quit]
q66 has joined #ocaml
pygmalion has joined #ocaml
pygmalion has quit [Ping timeout: 260 seconds]
ontologiae has joined #ocaml
Drup1 has joined #ocaml
Drup has quit [Read error: Connection reset by peer]
Drup has joined #ocaml
Drup1 has quit [Ping timeout: 245 seconds]
breakds has joined #ocaml
introom has quit [Remote host closed the connection]
osa1 has quit [Quit: Konversation terminated!]
osa1 has joined #ocaml
introom has joined #ocaml
cthuluh has quit [Ping timeout: 246 seconds]
ontologiae has quit [Remote host closed the connection]
ollehar has quit [Ping timeout: 240 seconds]
osa1 has quit [Ping timeout: 276 seconds]
malo has joined #ocaml
ollehar has joined #ocaml
zpe has joined #ocaml
pygmalion has joined #ocaml
pygmalion has quit [Ping timeout: 276 seconds]
<ousado> pippijn: aldor is written in C?
<pippijn> ousado: yes
ollehar has quit [Ping timeout: 245 seconds]
<ousado> pippijn: does it also compile to C?
<pippijn> yes
<pippijn> and java, and lisp
<pippijn> but the java backend is not complete
<ousado> look very interesting
<ousado> *looks
mattrepl has joined #ocaml
<ousado> pippijn: how is memory managed in aldor?
hto has joined #ocaml
<pippijn> ousado: GC, and you can optionally free stuff manually, but then it's up to you to ensure memory safety
<pippijn> ousado: in the java backend, free() is a nop
<Armael> neat
<mrvn> pippijn: generational moving GC?
<pippijn> mrvn: plain conservative
<pippijn> optionally boehm gc
<pippijn> this is something I want to improve, though
<mrvn> so pretty much totaly useless
<pippijn> yes
<pippijn> in fact
<pippijn> the GC is truly bad
<pippijn> I have made some graphs about it a few years ago
<pippijn> it's very, very irregular
<pippijn> sometimes it blocks for several seconds
<mrvn> that is even worse. I was just refering to the fact that it doesn't free up stuff and fragments memory
<pippijn> better use boehm
<pippijn> but the original author wrote that gc and is in love with it
<pippijn> the GC is definitely something I want to work on
<pippijn> actually that is also a main reason why I was thinking of targetting ocaml
<pippijn> that, and closures
<pippijn> actually closures are not that bad
<pippijn> in java, I have a problem with polymorphism
<pippijn> it requires me to box every int
ben_zen has joined #ocaml
<pippijn> I could do monomorphisation
hto has quit [Read error: Connection reset by peer]
<pippijn> that might seriously blow up the code, though
hto has joined #ocaml
<pippijn> there needs to be a pass that makes local t out of 'a
<pippijn> that helps a *lot*
<pippijn> parameter assignment is very bad, because inside a function, the parameter may be known to be int
<pippijn> but when assigning to the parameter, it needs to convert back to 'a (Word class)
<ousado> I can't find the typer
<ousado> where is it?
<pippijn> ousado: tinfer, ti_*
<pippijn> almost t*
<pippijn> tform, tfcond, tfsat
<pippijn> tposs
<pippijn> tqual
<ousado> OK :)
introom has quit [Remote host closed the connection]
letoh has joined #ocaml
pygmalion has joined #ocaml
xavierm02 has quit [Remote host closed the connection]
<ggole> That's the cost of uniform representation
<ggole> It's tagging, boxing, or specialisation
<ggole> All with their own pitfalls
pygmalion has quit [Ping timeout: 276 seconds]
zpe has quit [Remote host closed the connection]
emmanuelux has joined #ocaml
cthuluh has joined #ocaml
pygmalion has joined #ocaml
pygmalion has quit [Ping timeout: 276 seconds]
<orbitz> Is it possible to make a string smaller without a memory allocatin?
<pippijn> no
<orbitz> shame
<pippijn> make a wrapper
<mrvn> bigarrays support slicing.
<pippijn> yeah, or that
<pippijn> I should get more into bigarrays
<pippijn> I just always feel they are overkill
<orbitz> I just won't worry about the allocation right now
<pippijn> they probably are, because I deal with small strings
<mrvn> below 64 byte?
<pippijn> usually yes
<orbitz> YOu'd think strings would support resizing thouhg, it's just the API isn't there
montik has quit [Ping timeout: 256 seconds]
<pippijn> you're saying that bigarrays become feasible at 64 bytes?
<mrvn> don't worry then
<mrvn> iirc 64byte is the limit for small allocation
<pippijn> ah
<pippijn> what happens when it's a big allocation?
<mrvn> iirc it gets allocated as an older generation so it doesn't get cleaned up as quickly
<pippijn> I see
<adrien_> orbitz: but ocaml strings are compatible with C strings
<adrien_> they are null-terminated
<adrien_> it's basically [length][...content...][NULL]
<adrien_> [length][...content...] is the ocaml string
<adrien_> [...content...][NULL] is the C string
eni has joined #ocaml
<mrvn> actualy [length/4][content][0]*[length % 4]
<pippijn> that's messed up
<pippijn> mrvn: why?
<orbitz> adrien_: Right, which means modifyign the elngth should be a possible and trivial thing
<orbitz> pippijn: because the last length is how many of the previosu 4 bytes are part of teh string
<adrien_> orbitz: no, because reducing the size would mean adding a NULL byte in the middle of the string
<pippijn> ah
<mrvn> Every ocaml block has a header. The header has the length of the block in words (length/4) and the string just has the length%4 as extra info.
<pippijn> right
<orbitz> adrien_: which is exactly what you'd want
<pippijn> the number of words
<pippijn> mrvn: so /8 on 64 bit?
<mrvn> pippijn: should be
<mrvn> The length%4 part can be negative too I think.
<adrien_> orbitz: ah; I would have wanted to keep the original string too
<orbitz> adrien_: if i make a string smaller obviously I can't keep the original
<mrvn> A string of length 7 would have one 4 zero byte and then the length correction.
<mrvn> -one
<adrien_> orbitz: you could
<adrien_> you could only allocate a header which gives the location of the string and its length
<mrvn> orbitz: make a wrapper class that stores (offset, length, string)
<mrvn> orbitz: or just copy. With <64 byte copying might even be faster than the overhead of the wrapper
<ggole> Avoiding reallocating is why so many string functions take position/length params
<orbitz> I can't, Someoen is giving me a string
<ggole> (Like the Unix stuff)
<orbitz> It's fine, i was just tseeing if it was passoible
<orbitz> it doens't really matter
<ggole> If it's C code, you could just stuff a zero in there
<adrien_> dirname really is an awful API
<adrien_> modifies its argument in C
<adrien_> oh and worse
<adrien_> dirname("/foo/bar"); is undefined behaviour in C
<mrvn> adrien_: obviously.
<adrien_> but by default, GCC won't help you notice it
<mrvn> It's plain wrong and the compiler will tell you so
<adrien_> and if it's 3 level deeps...
<adrien_> mrvn: definitely not
<adrien_> -Wwrite-strings in GCC is not default, is not in -Wall, is not in -Wextra
<adrien_> (for C)
<adrien_> have to go
<mrvn> right, g++ does warn by default: foo.c:2:32: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
<ggole> A bad string api in C?
mattrepl has quit [Quit: mattrepl]
* ggole gasps in shock
<mrvn> C doesn't have strings
<ggole> (dirname is a bit of a shocker though)
<mrvn> At least dirname() only returns a static string or the original modified. It doesn't alloc as well.
pygmalion has joined #ocaml
ben_zen has quit [Ping timeout: 276 seconds]
malo has quit [Ping timeout: 240 seconds]
yezariaely has quit [Quit: Leaving.]
zpe has joined #ocaml
zpe has quit [Ping timeout: 245 seconds]
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
yezariaely has joined #ocaml
emmanuelux has quit [Ping timeout: 240 seconds]
osnr has quit [Quit: Leaving.]
ttamttam1 has quit [Quit: ttamttam1]
emmanuelux has joined #ocaml
emmanuelux has quit [Remote host closed the connection]
osa1 has joined #ocaml
pygmalion has quit [Ping timeout: 276 seconds]
eni has quit [Ping timeout: 246 seconds]
tobiasBora has joined #ocaml
f[x] has joined #ocaml
ollehar has joined #ocaml
pygmalion has joined #ocaml
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
iZsh has quit [Quit: Coyote finally caught me]
pygmalion has quit [Ping timeout: 264 seconds]
iZsh has joined #ocaml
iZsh has quit [Excess Flood]
iZsh has joined #ocaml
alang_ has joined #ocaml
walter has joined #ocaml
travisbrady has joined #ocaml
darkf has quit [Quit: Leaving]
f[x] has quit [Ping timeout: 240 seconds]
mcclurmc has quit [Ping timeout: 260 seconds]
osa1 has quit [Ping timeout: 260 seconds]
tobiasBora has quit [Ping timeout: 246 seconds]
travisbrady has quit [Quit: travisbrady]
eni has joined #ocaml
walter has quit [Quit: This computer has gone to sleep]
tobiasBora has joined #ocaml
tobiasBora has quit [Ping timeout: 245 seconds]
tobiasBora has joined #ocaml
joseanpg has joined #ocaml
pygmalion has joined #ocaml
pygmalion has quit [Ping timeout: 256 seconds]
joseanpg has quit [Quit: #javascript]
Anarchos has joined #ocaml
Arsenik has quit [Remote host closed the connection]
<Anarchos> how to debug exceptions in the GC ?
cthuluh has quit [Remote host closed the connection]
<mrvn> add printf to your C code.
<Anarchos> i did
<Anarchos> no other ideas ?
<Anarchos> it is crashing in caml_oldify_one
<Anarchos> so very difficult to track what is the faulty root not declared as global...
<mrvn> what kind of exceptions does the GC throw? I only now that ocaml segfaults when you corrupt the memory.
<mrvn> try valgrind
<Anarchos> mrvn i can't use valgring on my OS
<mrvn> bummer
<Anarchos> it is a multithreaded C application, linked with ocaml
<mrvn> does it happen on start or after a while?
<mrvn> Do you pass C pointer to ocaml directly or only in custom blocks with finalizer?
<Anarchos> mrvn it is encapsulated as a field in a block.
<mrvn> When you free that pointer in C it can happen that the GC allocates a new heap that contains that address and then the field in the block suddenly becomes GC manages and bad things happen.
<Anarchos> mrvn i don't free them :)
<mrvn> hmm, that prevents that
ggole has quit []
<Anarchos> anyway is there a mean to discover which address were freed on the C side and reallocate within ocaml ?
<mrvn> maybe print all the C pointers you pass to ocaml and then check what address it tries to modify in the crash
<mrvn> glibc has stubs to monitor alloc and free calls but you probably don't have glibc.
<Anarchos> i have glibc :)
<mrvn> but no valgrind? hmm
<Anarchos> mrvn i am on haiku, honestly i don't know if valgrind runs on it
<mrvn> Anarchos: man malloc_hook
travisbrady has joined #ocaml
<Anarchos> mrvn ok thanks
<mrvn> But if you never free the C pointers passed to ocaml then nothing bad should ever happen.
<mrvn> Can you gleam anything from the size and tags of the block it crashes on?
pygmalion has joined #ocaml
<Anarchos> mrvn no, sadly
pygmalion has quit [Ping timeout: 264 seconds]
<mrvn> zsh: segmentation fault ./client.native
<mrvn> I think I found a bug in OcamlSDL
cthuluh has joined #ocaml
<mrvn> Stupid off-by-one error
Anarchos is now known as mmlr_fan
mmlr_fan is now known as Anarchos
travisbrady has quit [Quit: travisbrady]
tobiasBora has quit [Ping timeout: 245 seconds]
pygmalion has joined #ocaml
mye has quit [Quit: mye]
chambart has joined #ocaml
<mrvn> My "GUI" no handles mouse-over effects.
<mrvn> layout done, mouse movement done, next: mouse clicks
<mrvn> I think i also need something to handle keyboard focus. Keyboard events shouldn't always go to the widget the mouse is over.
mattrepl has joined #ocaml
Yoric has quit [Ping timeout: 246 seconds]
chambart has quit [Ping timeout: 245 seconds]
cthuluh has quit [Read error: Operation timed out]
tobiasBora has joined #ocaml
cthuluh has joined #ocaml
eni has quit [Quit: Leaving]
osnr has quit [Quit: Leaving.]
zpe has joined #ocaml
<mrvn> If I have a class t can I get the type of that somehow?
zpe has quit [Remote host closed the connection]
<orbitz> as in the name?
<mrvn> as in to cast something to that type or ensure it has the right interface
<mrvn> I was looking for class foo = object (self : 'self) ... end
ollehar1 has joined #ocaml
ollehar has quit [Ping timeout: 246 seconds]
<Anarchos> mrvn use coercition : (o: t1 :> t)
structuralist has joined #ocaml
ollehar has joined #ocaml
ollehar1 has quit [Ping timeout: 260 seconds]
tane has quit [Quit: Verlassend]
Simn has quit [Quit: Leaving]
<ollehar> can I make a copy of an object as with a record `{r with fields =... }
<ollehar> ?
<ollehar> asdasd
ollehar has quit [Quit: ollehar]
ollehar has joined #ocaml
<ollehar> bla
<ollehar> can I make a copy of an object as with a record, `{r with field = ... }`?
<ollehar> e.g., I want to replace a function in an object
<Anarchos> ollehar nothing about that in the manual ?
<mrvn> ollehar: Obj.copy
Anarchos has quit [Quit: Vision[0.9.7-H-130604]: i've been blurred!]
<mrvn> ollehar: and then you need a method in the object that changes the value you want changed
<ollehar> I don't have control over the original class :P
<mrvn> derive a new one
def-lkb_ is now known as def-lkb
zpe has joined #ocaml
zpe has quit [Ping timeout: 240 seconds]
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
<ollehar> there's no class, only a class type. must I copy-paste the declaration?
<mrvn> what happens if you inherit it?
<ollehar> there's nothing to inherit since there is no class :(
<ollehar> "Unbound class Netcgi.cgi"
<ollehar> I checked the netcgi.mli, and there's a class type "cgi"
<ollehar> ah, but there must be other classes with this type, right?
<ollehar> "real" classes
<ollehar> will look more
<mrvn> is it even a class? Could be just a module
<ollehar> it's a class type
<ollehar> not sure I know the difference
<ollehar> will sleep on this, thanks for your tips!
eikke has joined #ocaml
ollehar has quit [Ping timeout: 264 seconds]
pygmalion has quit [Ping timeout: 260 seconds]
eikke has quit [Ping timeout: 246 seconds]
Neros has quit [Read error: Connection reset by peer]
ollehar has joined #ocaml
pygmalion has joined #ocaml
eikke has joined #ocaml