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/
zRecursive has joined #ocaml
mfp has quit [Ping timeout: 240 seconds]
gnuvince has joined #ocaml
gnuvince has quit [Changing host]
gnuvince has joined #ocaml
PM has quit [Ping timeout: 256 seconds]
Drup has quit [Quit: Leaving.]
zendessert has quit [Ping timeout: 246 seconds]
q66 has quit [Quit: Leaving]
Neros has quit [Ping timeout: 240 seconds]
madroach has quit [Ping timeout: 248 seconds]
madroach has joined #ocaml
pkrnj has quit [Quit: Textual IRC Client: www.textualapp.com]
zRecursive has left #ocaml []
csakatoku has joined #ocaml
introom has joined #ocaml
csakatoku has quit [Remote host closed the connection]
osa1 has quit [Ping timeout: 246 seconds]
introom has quit [Remote host closed the connection]
csakatoku has joined #ocaml
darkf has joined #ocaml
csakatoku has quit [Remote host closed the connection]
csakatoku has joined #ocaml
tane has quit [Remote host closed the connection]
csakatoku has quit [Remote host closed the connection]
ygrek has joined #ocaml
ygrek has quit [Remote host closed the connection]
ygrek has joined #ocaml
weie_ has joined #ocaml
weie has quit [Ping timeout: 248 seconds]
breakds has quit [Remote host closed the connection]
PM has joined #ocaml
ben_zen has joined #ocaml
csakatoku has joined #ocaml
shinnya has quit [Ping timeout: 268 seconds]
yacks has quit [Ping timeout: 248 seconds]
Simn has joined #ocaml
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
csakatoku has quit [Ping timeout: 276 seconds]
osnr has quit [Ping timeout: 246 seconds]
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
bholst has joined #ocaml
osnr has quit [Ping timeout: 240 seconds]
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
<emias> n
csakatoku has joined #ocaml
ben_zen has quit [Ping timeout: 268 seconds]
ben_zen has joined #ocaml
Zeev has joined #ocaml
osnr has quit [Quit: Leaving.]
Patchou has joined #ocaml
thomasga has joined #ocaml
thomasga has quit [Client Quit]
rks`_ has joined #ocaml
orbitz_ has joined #ocaml
gustav__ has joined #ocaml
Nahra_ has joined #ocaml
Derander has joined #ocaml
milosn_ has joined #ocaml
ben_zen has quit [Ping timeout: 240 seconds]
tizoc` has joined #ocaml
Nahra_ has quit [Ping timeout: 246 seconds]
bholst has quit [Ping timeout: 246 seconds]
clog has quit [Ping timeout: 246 seconds]
clog_ has joined #ocaml
ipoulet_ has joined #ocaml
tizoc` has joined #ocaml
Nahra_ has quit [Ping timeout: 246 seconds]
pr_ has joined #ocaml
milosn has joined #ocaml
contempt has quit [Ping timeout: 256 seconds]
bholst has quit [Ping timeout: 246 seconds]
contempt has joined #ocaml
bobry has joined #ocaml
avsm has joined #ocaml
chris2_ has joined #ocaml
adrien_ has joined #ocaml
<adrien_> hmmm, is it possible to update godi installations? like going from rocketboost (v2) to skylift (v3)
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
hyperbor1ean has joined #ocaml
tizoc has joined #ocaml
<adrien_> well, mv'ed my old install
tizoc` has quit [*.net *.split]
milosn_ has quit [*.net *.split]
Derander has quit [*.net *.split]
cdidd has quit [*.net *.split]
adrien has quit [*.net *.split]
clog has quit [*.net *.split]
ipoulet has quit [*.net *.split]
TaXules has quit [*.net *.split]
chris2 has quit [*.net *.split]
hyperboreean has quit [*.net *.split]
pr has quit [*.net *.split]
Derander has joined #ocaml
bholst has joined #ocaml
TaXules has joined #ocaml
Zeev has quit [Read error: Connection reset by peer]
orbitz has joined #ocaml
ohama has quit [Disconnected by services]
ohama has joined #ocaml
Zeev has joined #ocaml
mal``` has joined #ocaml
csakatoku has quit [Remote host closed the connection]
orbitz_ has quit [*.net *.split]
mal`` has quit [*.net *.split]
balouis has quit [*.net *.split]
balouis has joined #ocaml
bholst_ has joined #ocaml
TaXules_ has joined #ocaml
avsm has quit [Quit: Leaving.]
sgnb has quit [*.net *.split]
jbrown has quit [*.net *.split]
willb1 has quit [*.net *.split]
bholst has quit [*.net *.split]
TaXules has quit [*.net *.split]
tianon has quit [*.net *.split]
ccasin has quit [*.net *.split]
ggherdov has quit [*.net *.split]
IbnFirnas has quit [*.net *.split]
Leonidas has quit [*.net *.split]
flux has quit [*.net *.split]
Ptival has quit [*.net *.split]
zzz_ has quit [*.net *.split]
ohama has quit [*.net *.split]
Derander has quit [*.net *.split]
rks`_ has quit [*.net *.split]
darkf has quit [*.net *.split]
BiDOrD has quit [*.net *.split]
companion_cube has quit [*.net *.split]
def-lkb has quit [*.net *.split]
mrvn has quit [*.net *.split]
talzeus_ has quit [*.net *.split]
olasd has quit [*.net *.split]
rednovae_ has quit [*.net *.split]
gbluma has quit [*.net *.split]
cthuluh has quit [*.net *.split]
so has quit [*.net *.split]
balouis has quit [*.net *.split]
Simn has quit [*.net *.split]
patronus_ has quit [*.net *.split]
buddyholly has quit [*.net *.split]
vpit3833 has quit [*.net *.split]
The_third_man has quit [*.net *.split]
yroeht has quit [*.net *.split]
thizanne has quit [*.net *.split]
NaCl has quit [*.net *.split]
amiller has quit [*.net *.split]
MarcWeber has quit [*.net *.split]
hyperbor1ean has quit [*.net *.split]
adrien_ has quit [*.net *.split]
milosn has quit [*.net *.split]
pr_ has quit [*.net *.split]
gnuvince has quit [*.net *.split]
tchell has quit [*.net *.split]
tlockney has quit [*.net *.split]
jpdeplaix has quit [*.net *.split]
balouis has joined #ocaml
ohama has joined #ocaml
Derander has joined #ocaml
hyperbor1ean has joined #ocaml
adrien_ has joined #ocaml
milosn has joined #ocaml
pr_ has joined #ocaml
rks`_ has joined #ocaml
Simn has joined #ocaml
darkf has joined #ocaml
gnuvince has joined #ocaml
patronus_ has joined #ocaml
tchell has joined #ocaml
buddyholly has joined #ocaml
BiDOrD has joined #ocaml
vpit3833 has joined #ocaml
mrvn has joined #ocaml
companion_cube has joined #ocaml
def-lkb has joined #ocaml
The_third_man has joined #ocaml
yroeht has joined #ocaml
tlockney has joined #ocaml
talzeus_ has joined #ocaml
olasd has joined #ocaml
rednovae_ has joined #ocaml
gbluma has joined #ocaml
cthuluh has joined #ocaml
thizanne has joined #ocaml
zzz_ has joined #ocaml
Ptival has joined #ocaml
flux has joined #ocaml
Leonidas has joined #ocaml
IbnFirnas has joined #ocaml
ggherdov has joined #ocaml
ccasin has joined #ocaml
tianon has joined #ocaml
NaCl has joined #ocaml
jpdeplaix has joined #ocaml
so has joined #ocaml
amiller has joined #ocaml
sgnb has joined #ocaml
jbrown has joined #ocaml
MarcWeber has joined #ocaml
willb1 has joined #ocaml
tianon has quit [*.net *.split]
ccasin has quit [*.net *.split]
ggherdov has quit [*.net *.split]
IbnFirnas has quit [*.net *.split]
Leonidas has quit [*.net *.split]
flux has quit [*.net *.split]
Ptival has quit [*.net *.split]
zzz_ has quit [*.net *.split]
tianon has joined #ocaml
ccasin has joined #ocaml
ggherdov has joined #ocaml
IbnFirnas has joined #ocaml
Leonidas has joined #ocaml
flux has joined #ocaml
Ptival has joined #ocaml
zzz_ has joined #ocaml
srcerer has quit [Ping timeout: 248 seconds]
milosn_ has joined #ocaml
gnuvince has quit [Ping timeout: 255 seconds]
milosn has quit [Remote host closed the connection]
gnuvince- has joined #ocaml
darkf_ has joined #ocaml
talzeus has joined #ocaml
rks` has joined #ocaml
BiDOrD_ has joined #ocaml
ohama has quit [Disconnected by services]
milosn has joined #ocaml
ohama has joined #ocaml
def-lkb_ has joined #ocaml
gbluma_ has joined #ocaml
cthuluh_ has joined #ocaml
olasd_ has joined #ocaml
companion_square has joined #ocaml
osnr has quit [Quit: Leaving.]
Derander_ has joined #ocaml
rednovae has joined #ocaml
mrvn_ has joined #ocaml
gnuvince- has quit [*.net *.split]
milosn_ has quit [*.net *.split]
Derander has quit [*.net *.split]
rks`_ has quit [*.net *.split]
darkf has quit [*.net *.split]
BiDOrD has quit [*.net *.split]
companion_cube has quit [*.net *.split]
def-lkb has quit [*.net *.split]
mrvn has quit [*.net *.split]
talzeus_ has quit [*.net *.split]
olasd has quit [*.net *.split]
rednovae_ has quit [*.net *.split]
gbluma has quit [*.net *.split]
cthuluh has quit [*.net *.split]
so has quit [*.net *.split]
olasd_ is now known as olasd
Zeev has quit [Read error: Connection reset by peer]
Zeev has joined #ocaml
so has joined #ocaml
so has quit [*.net *.split]
so has joined #ocaml
shinnya has joined #ocaml
darkf_ is now known as darkf
avsm has joined #ocaml
Snark has joined #ocaml
chris2_ is now known as chris2
q66 has joined #ocaml
cthuluh_ is now known as cthuluh
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
lopex has joined #ocaml
mcclurmc has joined #ocaml
osnr has quit [Ping timeout: 256 seconds]
introom has joined #ocaml
<pippijn> whitequark: I made an ubuntu ppa with menhir in it
<adrien_> yurk: broken ocaml-gettext :P
<adrien_> > make[366]: Entering directory `/opt/ocaml/build/godi/godi-ocaml-gettext/work/ ocaml-gettext-0.3.4/ocaml-gettext'
<adrien_> 366 recursive calls for "install-buildprog-opt" is when I decided to cancel it :P
osa1 has joined #ocaml
<whitequark> pippijn: oh, neat
<pippijn> whitequark: when merr has an install routine, I will add that, too
tobiasBora has joined #ocaml
mye has joined #ocaml
Drup has joined #ocaml
rednovae has quit [*.net *.split]
gbluma_ has quit [*.net *.split]
ohama has quit [*.net *.split]
rednovae has joined #ocaml
gbluma has joined #ocaml
ohama has joined #ocaml
dsheets has quit [Ping timeout: 240 seconds]
avsm has quit [Quit: Leaving.]
introom has quit [Remote host closed the connection]
<adrien_> between ocaml 3.12.1 and ocaml 4.00
<adrien_> -rw-r--r-- 1 root root 1150696 Jul 20 10:57 /opt/ocaml-4/lib/ocaml/std-lib/stdlib.a
<adrien_> -rw-r--r-- 1 root root 954226 Oct 22 2011 /opt/ocaml/lib/ocaml/std-lib/stdlib.a
ggole has joined #ocaml
introom has joined #ocaml
introom has quit [Remote host closed the connection]
introom has joined #ocaml
ollehar has joined #ocaml
bernardofpc has quit [Quit: leaving]
bernardofpc has joined #ocaml
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
osnr has quit [Ping timeout: 276 seconds]
<mrvn_> How do I specify implicit subtyping for methods in a class type?
<mrvn_> class type foo = object method foo : string end and bar = object inherit foo method bar : string end and t = object method push : #foo -> unit end;;
<mrvn_> The method push has type (#foo as 'a) -> unit where 'a is unbound
<mrvn_> method push : 'a . (#foo as 'a) -> unit ==> The universal type variable 'a cannot be generalized: it escapes its scope.
mrvn_ is now known as mrvn
breakds has joined #ocaml
cdidd has joined #ocaml
<mrvn> Damn, the problem seems to be the "and"
<ggole> Don't you need a type variable argument for that?
<mrvn> ggole: 'a . (#foo as 'a) -> unit?
<ggole> Uh
<ggole> Let's see
<ggole> class type foo = object method foo : string end and bar = object inherit foo method bar : string end and ['a] t = object constraint 'a = #foo method push : #foo -> unit end
<ggole> Type checks: I'm not sure if it is what you want though
<mrvn> That wouldn't subtype the argument. That just creates different types depending on the argument.
<ggole> Oh, hmm
<mrvn> ggole: t#push (new foo) and t#push (new bar) need to work.
<mrvn> t#push ((new bar) :> foo) is anyoing to type.
<ggole> Right.
<mrvn> It works fine if I declare each class type on its own. But if I declare them as a group with "and" it fails.
<mrvn> And I have a recursion between the two classes so they need "and"
csakatoku has joined #ocaml
clog has joined #ocaml
<adrien_> hmm, I can't remember for sure: when linking against a pack, is the whole pack always fully pulled?
csakatoku has quit [Remote host closed the connection]
<mrvn> lets see what the mailinglist says to my problem
<pippijn> adrien_: bytecode or native?
<adrien_> native
<pippijn> then I don't think so
<pippijn> I suppose it goes to the system linker, which links only reachable symbols
<pippijn> not reachable, referenced
<whitequark> pippijn: won't that be the same? reachable from toplevel
<pippijn> if false then unreachable ()
<whitequark> well, this depends on your definition of "reachable" :)
<pippijn> just wanted to make sure
<whitequark> it's a bikeshed anyway.
<whitequark> also do you have some time?
<pippijn> a little bit
<whitequark> good
<mrvn> pippijn: well, false might be true one day :)
<whitequark> pippijn: the Cyclone paper mentioned that they needed to manually set function effects, though only once in 100KLOC
<whitequark> do you happen to know why? I couldn't reaily imagine a case where this would be neede
<whitequark> *needed.
<pippijn> whitequark: sorry, can you remind me of what effects are here?
<pippijn> it's been some years since I touched that
<adrien_> hmm, I believe the whole pack is pulled
<whitequark> pippijn: as I understand it: the list of regions which the function may touch. by default Cyclone infers effects as just a set of regions occuring in the signature
<whitequark> since it only has the heap and LIFO arenas, I don't see why that wouldn't suffice for anything
<mrvn> ggole: I lifted the recursion now: http://paste.debian.net/17266/
<pippijn> right
<pippijn> ok, let me think
<mrvn> ggole: makes for ugly types in errors though.
<pippijn> whitequark: I don't know
<pippijn> whitequark: let me check my code
ollehar has quit [Ping timeout: 252 seconds]
<pippijn> I seem to have some explicit heap region annotations
<whitequark> hmm
<pippijn> whitequark: sorry, I don't remember why it's required
<pippijn> maybe it's just a compiler weakness
<whitequark> I can see why you would want to annotate your code with a heap region
<whitequark> no, not like that
<ggole> mrvn: mmm, I can't see how to do it
<pippijn> I think you need it for arguments
<whitequark> I can see why effects in heap region may require explicit annotations
<ggole> Not that my object-fu is particularly strong
<whitequark> looking at the inference algorithm
<mrvn> ggole: I think it is a bug in the type system that it fails with "and"
<ggole> If you separate it so that foo and bar recur, but t does not, it type checks
<ggole> But it will just fail later when you try to define a class of type t
csakatoku has joined #ocaml
<mrvn> ggole: foo and bar aren't recursive, that is just plain inheritance.
<mrvn> foo and t are recusrive (or w and t in my last paste)
<ggole> Right
avsm has joined #ocaml
Neros has joined #ocaml
csakatoku has quit [Ping timeout: 264 seconds]
csakatoku has joined #ocaml
dsheets has joined #ocaml
tobiasBora has quit [Read error: Connection reset by peer]
tobiasBora has joined #ocaml
jbrown has quit [Remote host closed the connection]
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
osnr has quit [Ping timeout: 246 seconds]
mye has quit [Quit: mye]
<orbitz> Generic question: when tokenizing something, take for example JSON, does the tokenizer know about strings and escapesequences and all that?
<whitequark> yes
<orbitz> A better phrasing of my question: string literals are 1 token, correct?
<mrvn> usualy
<pippijn> orbitz: not necessarily
<orbitz> i thin kfor my needs it makes sense
<mrvn> "foo" BAR "baz" in C would be multiple tokens
<pippijn> orbitz: it should know enough about escaping to know when a string starts and ends
<pippijn> that's it
<pippijn> it doesn't need to know \n or so
<orbitz> ok
<mrvn> then again that would be 3 string literals with string concatenation
<pippijn> so you can match it with "([^"]|\\.)*"
<mrvn> orbitz: often you have a special case in your tokenizer for strings and comments. It's hard / impossible to do them with normal regexps.
<pippijn> [^"\\]
<pippijn> for comments, if you have nested ones, yes
<pippijn> or if you have funny rules like "*)" is not the end of a comment
<whitequark> mrvn: macros don't exist in C at the tokenization time
<whitequark> so "foo" BAR "baz" is a syntax error :)
<mrvn> whitequark: cpp tokenizes too
<whitequark> but it doesn't concatenate strings I think
<whitequark> so there's no reason for "foo" "bar" to be a single token either
<orbitz> I'm not sure discussing the semantics of C are necessarily a productive use of our time :) thank you for the help
amirmc has joined #ocaml
introom has quit [Remote host closed the connection]
<mrvn> you should ask on a channel about dns server
<mrvn> ups
tobiasBora has quit [Quit: Konversation terminated!]
ollehar has joined #ocaml
<wmeyer`> orbitz: the lexer in ocaml is more than just regexp matcher, it allows to build non backtracking finite state machine.
<wmeyer`> because rules can be called explicitly from each production
amirmc has quit [Quit: Leaving.]
amirmc has joined #ocaml
ygrek has quit [Ping timeout: 240 seconds]
demonimin has quit [Ping timeout: 256 seconds]
ollehar has quit [Ping timeout: 246 seconds]
demonimin has joined #ocaml
avsm has quit [Ping timeout: 264 seconds]
dsheets has quit [Ping timeout: 245 seconds]
amirmc has quit [Ping timeout: 246 seconds]
ulfdoz has joined #ocaml
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
iZsh has quit [Quit: Coyote finally caught me]
osnr has quit [Ping timeout: 245 seconds]
tane has joined #ocaml
ulfdoz has quit [Ping timeout: 260 seconds]
snearch has joined #ocaml
Anarchos has joined #ocaml
<Anarchos> how can i do a full compact right after each call to an external C function linked with ocaml ?
<mrvn> let fn arg = let res = c_fn arg in Gc.compact (); res
<Anarchos> mrvn i would prefer to insert this in the interp.c file , just after C_CALL1.... C_CALLN
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
osnr has quit [Client Quit]
csakatoku has quit [Remote host closed the connection]
avsm has joined #ocaml
osa1 has quit [Ping timeout: 276 seconds]
<jpdeplaix> avsm: Is that your debian repo is down ? I have a 404 :/
<Anarchos> /join ocaml-fr
<avsm> jpdeplaix: i've got an ubuntu one. not had a chance to rebuild the debian one yet.
<avsm> jpdeplaix: i really hope the debian NEW queue unblocks soon. OPAM's been stuck in the incoming queue there for over a month. http://ftp-master.debian.org/new.html
ulfdoz has joined #ocaml
<jpdeplaix> avsm: ok, so do we switch to the ubuntu repo ?
<avsm> jpdeplaix: i'm not entirely sure. looks like libc has had a bump, so it doesn't cleanly work on wheezy
<avsm> but apt-get -t experimental on wheezy bumps the libc and lets it work
* Anarchos whishes to be skilled enough to debug the GC...
ollehar has joined #ocaml
<avsm> i've gone back to source installs on debian until i've had a chance to figure it out (or someone else tells me what the right thing to do is)
csakatoku has joined #ocaml
dsheets has joined #ocaml
<jpdeplaix> avsm: it seems to work on sid
ivan\ has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
<avsm> confusing. any chance you could reply to the ppa thread (preferably just cc opam-devel, not the caml-list_ with your findings?
Drup has quit [Ping timeout: 240 seconds]
ulfdoz has quit [Ping timeout: 264 seconds]
csakatoku has quit [Remote host closed the connection]
osa1 has joined #ocaml
iZsh has joined #ocaml
iZsh has quit [Excess Flood]
iZsh has joined #ocaml
gnuvince- has joined #ocaml
ulfdoz has joined #ocaml
csakatoku has joined #ocaml
darkf has quit [Quit: Leaving]
avsm has quit [Quit: Leaving.]
csakatoku has quit [Ping timeout: 248 seconds]
ggole has quit []
osa1 has quit [Ping timeout: 246 seconds]
yacks has joined #ocaml
gnuvince- has quit [Changing host]
gnuvince- has joined #ocaml
gnuvince- is now known as gnuvince
chris2 has quit [Ping timeout: 246 seconds]
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
snearch has quit [Quit: Verlassend]
pkrnj has joined #ocaml
ollehar has quit [Ping timeout: 246 seconds]
ollehar has joined #ocaml
mfp has joined #ocaml
osa1 has joined #ocaml
bondar has joined #ocaml
ollehar has quit [Ping timeout: 246 seconds]
<wmeyer`> adrien: ping
<Anarchos> wmeyer` pong..
<osa1> what's wrong with exception declaration: exception 'a NonLocalPoly of 'a ?
csakatoku has joined #ocaml
<mrvn> osa1: that would require runtime types
<osa1> mrvn: um .. how?
<mrvn> how do you want to use the 'a without knowing the type?
<osa1> mrvn: how do you know 'a in list type?
csakatoku has quit [Ping timeout: 260 seconds]
<mrvn> osa1: type inference. But you can't do that when catching an exception.
<osa1> why?
ollehar has joined #ocaml
<mrvn> where should the type come from?
<osa1> raise (MyException TypeOfThisExpressionIsA)
<mrvn> osa1: What if you rais and int NonLocalPoly but catch a float NonLocalPoly?
<mrvn> s/rais and/raise an/
<osa1> it's obviously a type error. I don't understand how is exceptions different than ordinary data types
<mrvn> osa1: because exceptions are not part of a functions type signature
<osa1> oooh
<osa1> ok, I think I get it now. thanks.
<orbitz> osa1: In polymorphic function yo ugive it a value you already know, inanexcpetion you receive soemthing, from god knows where
<mrvn> You can do: type t = { foo : 'a . 'a; } exception Foo of t;;
<osa1> orbitz: hmm, how do things change in existence of java style checked exceptions where methods has thrown exception in their signatures?
<mrvn> osa1: I don't think that should change anything
<orbitz> checked exceptions effectiavly are part of the methods type
<orbitz> But sitll, i nchecked excpetions you can only throw subtypes
<osa1> mrvn: I think in that case we can have a generic exception type and throw an instance of it without problems. that chages things.
<mrvn> osa1: the type must still be inferable.
<mrvn> or given
<osa1> mrvn: sure, we're not throwing a generic type, we're throwing an instance of it
<mrvn> what if you throw 2 of them, an int Foo and float Foo? How is that supposed to work?
<osa1> mrvn: no
<orbitz> how would you use the value you got back?
<mrvn> osa1: If you can throw [< int Foo | Bla] then you should also be able to declate [< int Foo | float Foo ] and that doesn't work.
<osa1> orbitz: think exception throwing method as 'void someMethod() throws GenericException<SomeObject>
<mrvn> declare even
<orbitz> osa1: Ocaml does not have checked exceptions
<osa1> I know
<mrvn> osa1: as objects you can do it, or as variant type. But that hides the 'a
<orbitz> I guess i'm still unclear on how you would use this object you got back in your exception. How do you determine what type it is?
<osa1> mrvn: hmm. I never used variant types. maybe I should spare some time and learn it
<mrvn> orbitz: you can't, that is the problem with his idea.
<orbitz> mrvn: sssh i know that :)
<mrvn> osa1: that should be the first thing you learn.
<mrvn> osa1: you could add runtime types through a GADT.
<mrvn> try ... with TypedException (Int, 1) -> ()
<osa1> mrvn: do GADTs add runtime costs?
<mrvn> in that use case yes.
<osa1> mrvn: hmm I thought GADTs don't add runtime costs, I've read somewhere about implementation of sytax trees using GADTs ...
<orbitz> what you are trying to do jsut soudns like a bad idea though
<orbitz> i woudln't resort to GADTs yet
ivan\ has joined #ocaml
<mrvn> osa1: in other cases they can be optimized out but not when you use them for runtime types
<mrvn> osa1: if you want to use an exception to return a value in a polymorphic function then you should use a variant type as return value instead.
<osa1> yeah .. so how do I know when a GADT causes runtime costs?
<mrvn> can one have function local exception? like let foo : 'a -> 'a = exception Foo of 'a try fun x -> raise (Foo x) with Foo x -> x?
<orbitz> This might be helpful too: https://ocaml.janestreet.com/?q=node/91
<mrvn> osa1: whenever you create values with them in it for sure.
<orbitz> this gives the record trick mrvn referred to
<osa1> mrvn: yeah that funciton local exceptions was what I was thinking first
<osa1> thanks for the link btw
<mrvn> That link also shows a function local exception
<mrvn> first class modules are just awesome.
<orbitz> IMO, exceptions aren't particuarlly good for what msot people use them for, the example inthe jane st link is soemthing i'd use them for
<mrvn> aborting a fold, map or iter is tiresome without exceptions
<orbitz> yes
<orbitz> I don't like to use exceptions for actually reporting errors
<osa1> that jane street links make me sad, I've just failed at my third Jane Street interview ;-(
<mrvn> as in you tried 3 times or you passe the first 2?
<osa1> in my case I was using exceptions as a non-local return tool
<orbitz> well, i wouldn't hire yo either if you've used ocaml and never used a variant
pkrnj has quit [Quit: Textual IRC Client: www.textualapp.com]
<osa1> mrvn: I don't know if I passed first two, but they wanted a third one so I guess I'm wasn't that bad in first two
<mrvn> how did you manage that without variant types?
<osa1> orbitz: right. I applied to internship positions as a haskell developer, not ocaml
<orbitz> hasekll has variants too...
<osa1> mrvn: how did you know that I did that without variant types?
<orbitz> you said you've never used a variant type before
<osa1> orbitz: I meant polymorphic variants
<orbitz> ok
<orbitz> i know what a polymorphic variant is
<osa1> yeah I pasted that link for myself, I'm not 100% sure about OCaml terms
<orbitz> I think in ocaml and an adt == variant == what haskell calls an adt
<mrvn> In the Janestreet link why does 'a return need to be a polymorphic record?
<orbitz> isn't it because it's meant to be generic? they say yo udon't need it if you use it in one place but they want it to work everywhere
Drup has joined #ocaml
<def-lkb_> mrvn: record are the usual way to introduce explicit quantification
Snark has quit [Quit: leaving]
<def-lkb_> mrvn: and we need that polymorphism so that r.return can be used in any context (after application, it has the type forall 'a. 'a)
<mrvn> but why do you need that?
<mrvn> with_return should always return the 'a type, unless you do that broken thing of having the return escape its scope.
<mrvn> def-lkb_: I'm looking for an example where return doesn't escape but it still doesn't work without the 'b
<def-lkb_> mmm, but the purpose of return is escaping?
<mrvn> no
<def-lkb_> (and it is not possible to produce a value of that type without escaping or looping)
<mrvn> def-lkb_: The return is supposed to be used up in the function passwd to with_return
<mrvn> def-lkb_: Look at the last example on https://ocaml.janestreet.com/?q=node/91. If it escapes all you can do is throw an uncatchable exception.
<def-lkb_> mrvn: yes… by escape I meant escaping the local stack-frame up to the enclosing with_return
kaustuv has joined #ocaml
<mrvn> def-lkb_: but I got it. Say you have a string return and code like this: ... if foo then r.return "" else 5 ...
<osa1> I'm wondering how can we get a similar effect of exceptions used as non-local returns in a purely functional settings without exceptions. with exceptions we can return from arbitrarily nested contexts(i.e. function calls), this is not easily possible in functional setting, without using Error monad transformers etc. like we do in Haskell ...
<mrvn> r.return never returns so its return type can unify with int.
<orbitz> osa1: I use Core's Result monad quite a bit
<def-lkb_> osa1: with delimited continuations ?
<mrvn> osa1: by match f ... with Exception x -> Exception x | Restult y -> ...
<osa1> orbitz: hmm that's same thing as ErrorT in Haskell, I guess?
<mrvn> osa1: on every level
<orbitz> osa1: I don't know about ErrorT, but it's effeivelty the Either monad
<osa1> mrvn: yeah currently that's how we do in Haskell (implicitly using monads, or explicitly)
<kaustuv> In an opam package, can I copy an entire directory using a .install file? E.g., can I say:
<kaustuv> share: ["examples"]
<def-lkb_> mrvn: precisely, sorry I wasn't able to make this use case more explicit, but it's exactly the purpose of this extra amount of polymorphism
<osa1> orbitz: right
<kaustuv> and have it copy foo.0.0/examples to share/foo/examples ?
<osa1> hmm, I've never thought of delimited continuations ..
<orbitz> osa1: what problem are you tryingto solve
<mrvn> what are delimited continuations?
<mrvn> osa1: I would just implement exceptions by passing an exception handler as extra continuation.
<osa1> orbitz: I don't have a problem in mind, I'm just exercising, I guess
<mrvn> let fn cont raise arg = if arg then cont 0 else raise Foo;;
<mrvn> raise `Foo even
<osa1> mrvn: that's a good idea. delimited continuation solution is also similar as the idea, I think
<def-lkb_> mrvn, osa1: Is a good introduction to delimited continuations http://okmij.org/ftp/continuations/implementations.html
<osa1> thanks for links
<mrvn> def-lkb_: but what are delimited continuations?
<osa1> I know normal continuations(implemented them in an interpreter, none of the expressions were returning anything, return values were passed to continuations etc.), are delimited ones too different?
<def-lkb_> delimited ones behave more like functions: instead of capturing the complete stack of execution, delimited continuations are built with control operators that permit to restrict the extent
<mrvn> The implementation sounds downright evil.
<mrvn> Messing wiht the stack and all
<osa1> mrvn: you're not thinking in terms of stack while implementing. implementation is actually very easy in high level languages.
<def-lkb_> yes, delimited continuation are built by capturing a chunk of stack
<osa1> mrvn: I had implemented a language with non-delimited continuations in Haskell, if you're interested http://github.com/osa1/toylisp it has call/cc
<mrvn> osa1: normal continuations are simple. That is just a closure.
<mrvn> or in haskell you have monads
kaustuv has left #ocaml []
<mrvn> Say I have a functor, e.g. Set, and I use int Set at several points in my code. Should I create a global module IntSet or instantiate the functor where needed?
* osa1 has a final exam in few hours and will continue investigating non-local returns later ...
Simn has quit [Quit: Leaving]
<wmeyer`> hi
ulfdoz has quit [Ping timeout: 264 seconds]
bondar has quit []
osnr has quit [Quit: Leaving.]
avsm has joined #ocaml
tane has quit [Quit: Verlassend]
mye has joined #ocaml
<Anarchos> Is this use of caml_register_global_root and assignment safe ? http://pastebin.com/7GhB5Rm6
<mrvn> That makes no sense
<mrvn> You can't have a ocaml value without the runtime system lock
<mrvn> and interne must be initialized before being added as root I believe
<Anarchos> mrvn this C++ constructor is called in a callback so i own the runtime system lock
<Anarchos> mrvn the problem is htis initialization i think
<mrvn> then what is the caml_acquire_runtime_system() doing there? That will deadlock.
<Anarchos> mrvn good point...
<mrvn> looks more like it is called from a C thread that the ocaml runtime knows nothing about: caml_c_thread_register();
<Anarchos> mrvn yes sorry you're really right
<Anarchos> you mean i should call caml_c_thread_register then caml_acquire_runtime_system then CAMLparam ?
<mrvn> hmm, haden't even thought of that. what do the docs say?
<Anarchos> mrvn nothing apart that caml_c_thread_register is used to register C threads to the runtime system
<mrvn> I'm not sure you can do CAMLparam1 later in the function.
<mrvn> But I would think that needs the runtime lock
<Anarchos> mrvn ok thank you i will investigate more
avsm has quit [Quit: Leaving.]
<mrvn> maybe split the function in 2. Glue::Glue(value ocaml_objet) { caml_c_thread_register(); caml_acquire_runtime_system(); self.Glue_with_lock(ocaml_objet); caml_release_runtime_system(); } Glue::Glue_with_lock(value ocaml_objet) { CAMLparam1(ocaml_objet); interne = ocaml_objet; caml_register_global_root(&interne); CAMLreturn0; }
<Anarchos> mrvn i am not sure if the "interne = ocaml_objet; " is correct to do the assignment in the global root interne, to trnasform ocaml_objet in a global root
<mrvn> interne = 0; works too.
<mrvn> or Val_unit
<mrvn> Anyhing the GC won't get confused about.
<mrvn> Where does the ocaml_objet come from? Because without the runtime lock that value isn't valid so you can't pass it to another function.
<Anarchos> mrvn ocaml_objet is an OCaml classes that i want to mimic in the C++ side...
<Anarchos> the ocaml runtime makes a callback in C which calls this C++ class
<mrvn> If it comes from ocaml then it has the ocaml runtime lock. Call Glue() then before giving it up
<Anarchos> mrvn i will try your solution :)
<mrvn> Getting it to run cleanly with a mixture of ocaml and c threads will be hard to test.
<Anarchos> mrvn i have a graphical application wich runs pretty smoothly
<Anarchos> with 3 threads
<Anarchos> time to go to bed
Anarchos has quit [Quit: Vision[0.9.7-H-130604]: i've been blurred!]
csakatoku has joined #ocaml
csakatoku has quit [Ping timeout: 252 seconds]