flux changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | 3.11.0 out now! Get yours from http://caml.inria.fr/ocaml/release.html
<Asmadeus> palomer: yes it is, see godi
<Asmadeus> that means quite a lot of compiling, but you can put it wherever you want
<palomer> Asmadeus, and I don't need admin priviledges?
<Asmadeus> none at all, you just need to be able to compile
<Asmadeus> which I guess you can, otherwise installing ocaml would be pointless :)
<Asmadeus> you tell godi where you want to install it, add the said place to your PATH, and it works pretty well
<palomer> but I need ocaml to install godi, no?
* palomer has just sent a lukewarm email to my admin
<palomer> the next one won't be so nice!
<Asmadeus> heh, no, it works with bootstrap
<palomer> wait...
<palomer> can I install everything on a usb key, and that usb key is self contained?
<palomer> but then if I want to use pcre or lablgtk2, I need my admin to install that system wide?
<mfp> palomer: you'll need libpcre3(-dev) and libgtk2.0-0(-dev) to be installed, but the OCaml bindings themselves are managed by GODI, and can live in the dir of your choice
<mfp> in fact, GODI recommends *not* to install as root, as there's "no advantage to it" (semi-literal)
<palomer> does godi install findlib?
<mfp> yes
<palomer> and omake?
* mfp checks
<mfp> yep
<mfp> it handles all the OCaml stuff, including ocamlopt and the usual infrastructure (findlib and friends)
m3ga has joined #ocaml
<palomer> well, I'm sold
<palomer> !
<palomer> I remember last time I tried to use GODI
<palomer> it failed on labltk or something
pierre_m has joined #ocaml
<mrvn> And you can compile pcre and gtk yourself and install it to ~/lib/ too.
vuln has quit [Read error: 110 (Connection timed out)]
ched_ has joined #ocaml
Ched has quit [Read error: 110 (Connection timed out)]
<palomer> mrvn, really??!?
<palomer> mrvn, how?
<palomer> seems like a huge undertaking
<mrvn> palomer: configure --prefix=~/lib, and yes it is.
<palomer> mrvn, but what about ldconfig?
<palomer> I thought you always need to ldconfig everything
<palomer> (was that "yes it is" sarcastic?)
<palomer> brb!
palomer has quit ["Leaving"]
<mrvn> ldconfig is purely caching things.
prime2 has joined #ocaml
vuln has joined #ocaml
seafood has quit []
seafood has joined #ocaml
seafood has quit [Read error: 110 (Connection timed out)]
prime2 has quit ["leaving"]
manju__ has joined #ocaml
manju_ has quit [Remote closed the connection]
vuln has quit ["leaving"]
jonafan_ has joined #ocaml
jonafan has quit [Read error: 60 (Operation timed out)]
Camarade_Tux has joined #ocaml
m3ga has quit ["disappearing into the sunset"]
kaustuv_ has left #ocaml []
pierre_m has quit [Read error: 110 (Connection timed out)]
pierre_m has joined #ocaml
_zack has joined #ocaml
ygrek has joined #ocaml
<flux> <200903271022.25199.peng.zang@gmail.com> (on "class constraints" by Peng Zang) makes me think, ocaml doesn't support covariant method return values in methods like c++ does?
<flux> I wonder if it matters, though :)
s4tan has joined #ocaml
komar_ has joined #ocaml
hkBst has joined #ocaml
jamii_ has quit [Read error: 110 (Connection timed out)]
rwmjones_ has joined #ocaml
ygrek has quit [Remote closed the connection]
LeCamarade has joined #ocaml
OChameau has joined #ocaml
<kaustuv> I'm a complete camlp4 newbie. Is it possible to use it to produce functions like [make_lo] in this example: http://ocaml.pastebin.com/m2d7c45a ? Should I be taking a look at type-conv and sexplib?
<flux> it looks like their turf, although I too have only passing knowledge of them :)
m3ga has joined #ocaml
komar_ has quit [Read error: 113 (No route to host)]
pierre_m has quit [Read error: 110 (Connection timed out)]
Yoric[DT] has joined #ocaml
rwmjones_ has quit ["Closed connection"]
deadc0de has joined #ocaml
s4tan has quit [Read error: 104 (Connection reset by peer)]
ygrek has joined #ocaml
hkBst has quit [Read error: 104 (Connection reset by peer)]
hsuh has joined #ocaml
m3ga has quit ["disappearing into the sunset"]
Yoric[DT] has quit ["Ex-Chat"]
Alpounet has joined #ocaml
_andre has joined #ocaml
<Alpounet> Do anyone have a good link about boxing/unboxing values ?
<flux> well, not in particular, but you should take a look at the section in manual that talks about interfacing with C
<Alpounet> ok
<Alpounet> thanks
ygrek has quit [Remote closed the connection]
<_andre> good morning
<_andre> say i have a file with contents "let _ = 1 + a". is it possible somehow (from camlp4) to catch the error "Unbound value a"?
<mrvn> and do what?
<_andre> report it differently
<Alpounet> you're trying to interpret OCaml code ?
<_andre> kinda... this is for OSpec... i would like to report errors in the specifications
<Alpounet> embedding the Toploop may be fine
<Alpounet> but kinda heavy
<_andre> i'm actually already doing that
<_andre> i'm using Toploop.use_file to run the specs
<_andre> (i think that's the function name)
<Alpounet> ok
<Alpounet> you can then catch errors
<_andre> but a try/with around it didn't seem to work
<Alpounet> it should
<Alpounet> Typecore.Error(_,_)
<Alpounet> Syntaxerr.Error(_)
<Alpounet> (in with clause)
<Alpounet> go on #mlbot
<Alpounet> you'll see
<Alpounet> and I'll paste some cod
<_andre> i tried with _ -> ...
<Alpounet> code*
<_andre> k
komar_ has joined #ocaml
s4tan has joined #ocaml
<Camarade_Tux> mfp, I just saw your post, nice :)
deadc0de has quit [Read error: 110 (Connection timed out)]
willb has joined #ocaml
slash_ has quit [Read error: 104 (Connection reset by peer)]
j_lenorm has joined #ocaml
<j_lenorm> http://pastebin.com/m2f7b55b7 <--- I tried installing godi and I get this error
<j_lenorm> how do I fix it?
<j_lenorm> ahh, found it
<j_lenorm> had to edit prefix/etc/godi.conf
willb has quit [Read error: 110 (Connection timed out)]
Mr_Awesome has quit [Read error: 60 (Operation timed out)]
<mfp> sometimes jdh is so hyperbolic it's funny, like a parody movie that's so, so bad it's actually good > "OCaml has an order of magnitude more successful open source projects than Haskell. OCaml has two orders of magnitude more well-tested lines of code than Haskell. OCaml software has two orders of magnitude more end users than Haskell. OCaml also has a much longer list of bigger success stories in industry than Haskell."
<mfp> also "In short, OCaml has several killer apps and Haskell still has none but I will grant you that Haskell programmers chat on IRC a lot more. Indeed, that is probably the explanation..."
<kaustuv> jdh == Jon D. Harrop?
<kaustuv> Is he on haskell-cafe too?
<kaustuv> Hmm, apparently not. Where did he post that? I want to read the responses.
<mfp> + the links
ygrek has joined #ocaml
<mfp> heh dons picked it already
<mfp> (kaustuv: yes, J. D. Harrop)
LeCamarade has quit ["Gone."]
<kaustuv> I see that true to character all his links are plugging his blogs and journals
<kaustuv> (Except for the FFTW link)
<j_lenorm> godi takes up more than 300 megs!
<j_lenorm> that's nuts!
<j_lenorm> time for a mud fest!
willb has joined #ocaml
<kaustuv> I am almost tempted to port the ocaml implementation to SML and see how MLton fares
<kaustuv> Oh it uses objects. Ugh.
<mfp> the problem is that even "porting" it to idiomatic OCaml would probably make it faster
<j_lenorm> ocaml implementation of what?
<mfp> (-> I only fixed a few things and it already got over 2X faster)
<kaustuv> j_lenorm: the main story from mfp's link above
<mfp> j_lenorm: a global illumination renderer
<mfp> case in point: if (Triangle.Null = hitObject) || ((Triangle.Obj emitter) = hitObject) then nobody here would ever write that (I hope)
<j_lenorm> what's wrong with that code?
* j_lenorm feels ashamed that he is capable of writing that
<mfp> j_lenorm: see http://eigenclass.org/R2/writings/minilight-cleanup scroll down to "Anti-pattern: if instead of pattern matching"
_zack has quit ["Leaving."]
<kaustuv> Even with pattern matching you cannot avoid the penalty of one structural =, and the rest is a small constant overhead. How often is this line executed?
<j_lenorm> oh, I see
<j_lenorm> an option type instead of null
<j_lenorm> and a when clause for the left part of the or expression
<mfp> kaustuv: all the time. That change alone makes it almost 25% faster or so IIRC.
* j_lenorm wonders why godi is so flippin' big
<mfp> kaustuv: and the author actually meant identity, not structural comparison there
<kaustuv> Ah, that would explain it.
<kaustuv> from the source comments: (array type implementation seemed same speed as record type implementation, but array might be slightly smaller)
<kaustuv> This is false for a float array as far as I know
<kaustuv> The size, I mean
<mfp> I think he meant the lines of code
<mfp> because, as you say, the block is the same size in mem
slash_ has joined #ocaml
<kaustuv> Why is he worried about loc when there are large comments and many blank lines?
<mfp> using an array allows to iterate over the components, instead of doing x, y and z by hand
<mfp> they're not included in the LoC counts
<mrvn> kaustuv: The aim was to make it simple.
<kaustuv> But he doesn't iterate over them anyway. See vFold, eg. He's inlined the fold.
<kaustuv> vClamp is even better
<mrvn> mfp: write Vec.iter and Vec.map
<mfp> uh?
<kaustuv> err, vCross, not vClamp
<mrvn> to iterateover x,y,z instead of an array
<hcarty> j_lenorm: godi is big because it includes a lot?
<mfp> mrvn: I mean iterating _in_ the definition of the actual functions defined in that module, with Array.xxx
jamii_ has joined #ocaml
<mfp> but as kaustuv said, he doesn't even do that (but IIRC there's some other code that indexes the components directly)
<j_lenorm> hcarty: probably
<j_lenorm> hcarty: as long as its less than 500 megs, It should be ok
<j_lenorm> oh, it was a rhetorical question
<hcarty> j_lenorm: I have a lot installed under my godi dir and it is only up to 454 megabytes
<j_lenorm> good!
<hcarty> So you're likely safe there
<mfp> using a float array is a bit slower than a record if the polymorphic functions aren't constrained
<mrvn> mfp: Why is normal and tangent lazy?
<hcarty> The godi/build/ dir is 110+ of that
<kaustuv> Maybe he's hand-inlined for efficiency reasons? Though dumpapprox shows that vFold is marked as inlinable
<mfp> (... slower because ocamlopt can't remove the check for unboxed arrays)
Amorphous has quit [Read error: 110 (Connection timed out)]
<kaustuv> Oh, .() is safe, right? I wonder if -unsafe gives any speedup...
willb1 has joined #ocaml
<mfp> mrvn: thought it wouldn't hurt and left it there just in case, but I've removed that caching to make the impl more comparable to the C++ one
<mrvn> mfp: I would just remove the lazy part. Calculating a normal and tangent per triangle while loading a scene is hardly costing time.
<mrvn> mfp: Checking if it was forced a million times hurts.
<mfp> mrvn: I have already removed it
<mrvn> mfp: commit :)
willb has quit [Remote closed the connection]
<kaustuv> Ah, he uses -unsafe already.
slash_ has quit [Read error: 104 (Connection reset by peer)]
<mfp> I don't know what he used. I wrote the OMakefile.
<kaustuv> I'm reading make/build-ocaml.sh
<mrvn> The way vector3f is written it really should be a record.
<mfp> ah that, I forgot about it, since it's not in my tree
<mfp> yeah
Narrenschiff has joined #ocaml
<j_lenorm> seems like everyone is switching to git...just when I'm getting used to svn!
<mrvn> let (!!) = Lazy.force ?
<mfp> mrvn: why not?
<mrvn> because you removed the lazies.
<mfp> ah I forgot to remove that?
Amorphous has joined #ocaml
<mfp> thought you referred to the notation itself
<mrvn> no. :)
<mrvn> "and edge3" - ' '
<mfp> pff there's more than enough confusing indentation & "interesting" code to worry about 1 space :P
<mrvn> mfp: I would use type t = { origin : vT; edge0 : vT; edge1 : vT; edge3 : vT; reflexivity : vT; emitivity : vT; bound : vT array array; }
<mrvn> + normal : vT; tangent : vT;
<mfp> that's exactly the optimization I meant to remove, because the C++ version doesn't do it
<mfp> so as to make the progs equivalent
<j_lenorm> ugh
<mrvn> Anything that is constant should be done only once.
<j_lenorm> lablgtk2 installs lablgl and labltk in godi
<j_lenorm> which gives me the error ===> TCL/TK not found
<mrvn> mfp: What is edge0, 1, 3?
<j_lenorm> anyone know if I can install tcl/tk in godi/lib ?
<mrvn> edge0 is the U vector, edge3 is the V vector spanning the triangle it seems.
<kaustuv> http://www.msr-inria.inria.fr/~kaustuv/misc/vector3f.sml for comparison. Was painless enough.
Narrenschiff_ has joined #ocaml
<jlouis> kaustuv: and now the $100 question: Is MLton significantly faster than Ocaml?
willb1 has quit ["Leaving"]
willb1 has joined #ocaml
<kaustuv> jlouis: I won't know until I've ported the other files over. Stay tuned!
<kaustuv> (I suspect it won't be much faster because this code is really first-ordery)
<mrvn> mfp: if you change normal t = vUnitize (vCross t.edge3 t.edge0) you can drop edge1 from the triangle too.
<mfp> kaustuv: I get +20% just by rewriting vClamp without using HOFs
<jlouis> kaustuv: a record is usually flattened by the mlton backend
<mrvn> mfp: maybe someone should cleanup the C++ code along the same lines so we can get a new comparison.
<jlouis> so the representation tends to be the same as the array
Alpounet has quit [Remote closed the connection]
<kaustuv> jlouis: Yes, I'm aware of it, but I'm just sticking with arrays for a fair comparison with the ocaml reference.
<mfp> mrvn: yes, if we want to keep the comparisons more or less meaningful
<mrvn> mfp: do you haveany classes left?
<jlouis> kaustuv: yeah. Ping me if you want me to give it a fast look.
<jlouis> I am, after all, in the process of writing an SML compiler, hehe
<jlouis> and I hacked a bit on mlton earlier
<mrvn> What does object (__) do?
<mfp> binds self to __
<kaustuv> Yet another SML compiler? Don't we have too many already?
<mrvn> what is the difference to object (_) or object?
<mfp> and then he does __#property
<jlouis> kaustuv: all of them suck
<mrvn> he does? Not in my source. :)
Narrenschiff has quit [Nick collision from services.]
<jlouis> kaustuv: besides, it is fun :)
<kaustuv> jlouis: the only suckiness of MLton is that it doesn't have a REPL
<kaustuv> (IMFO)
Narrenschiff_ is now known as Narrenschiff
<mrvn> I rather prefer object(self) if it is used. __ looks so perlish.
<mfp> ... let c = __#emittersCount ...
<jlouis> kaustuv: MLton is the cool one indeed
<kaustuv> Oh, and the source language is stagnant. If you want fun, implement some of the sML proposals on successor-ml.org
* mfp also uses self
<jlouis> kaustuv: that was the plan!
<mrvn> mfp: surfacePoint.ml
<jlouis> all of the succML proposals
<mrvn> let emitter = emitters_m.((FRandom.int rand land 65535 * c) lsr 16) in
<mrvn> is that faster than using fmod?
<kaustuv> I should pull out my sML -> SML desugarer that I was working on a few years back and take another shot.
<hcarty> j_lenorm: You can disable the opengl portion of lablgtk2 and that should avoid the need for lablgl and labltk
<mrvn> -f
<j_lenorm> hcarty: how?
<hcarty> j_lenorm: I don't remember the specific options, but it's in the godi configuration for the lablgtk2 package
<hcarty> j_lenorm: You'll likely have to clear the other labl* and conf* packages godi set as dependencies by hand as well
<kaustuv> First porting snag: Random. The result won't be SML'97.
<kaustuv> Oh hold on, MLton.Random doesn't even have a random float. I guess I have to fall back to smlnj-lib.
<mrvn> "Blink if you can hear me."
<j_lenorm> hrmph
<j_lenorm> it seems that tcl/tk is a requirement for many packages
<j_lenorm> might as well install it
<mrvn> kaustuv: random int + 1 / random int?
Yoric[DT] has joined #ocaml
<kaustuv> mrvn: no need, smlnj-lib's Random.randReal exactly produces a random float in [0.0, 1.0)
<kaustuv> I guess I'm being off topic on this channel now. Apologies.
<kaustuv> Surely it's "emissivity", not "emitivity"...
<j_lenorm> how can I tell godi where to find tcl/tk? I installed tcl/tk with the prefix /home/j/j_lenorm/lib, and then I added the line SEARCH_LIBS += /home/j/j_lenorm/lib , but it still complains that it can't find it
<j_lenorm> hrmph, I'm off to lunch
<j_lenorm> hopefully a full stomach will solve this
j_lenorm has quit [Remote closed the connection]
Ori_B_ has joined #ocaml
Ori_B_ has quit [Client Quit]
Ori_B has quit [Remote closed the connection]
s4tan has quit []
Ori_B has joined #ocaml
_zack has joined #ocaml
willb1 is now known as willb
willb has quit ["Leaving"]
willb has joined #ocaml
<rwmjones> _zack, ping
<_zack> rwmjones: heya
<rwmjones> _zack, can we make a release of ocaml-autoconf now? I really need it & I think we should
<rwmjones> any code that may remain from the first developer must be insignificant
<rwmjones> ie. totally written out of the current code
<_zack> rwmjones: hi thought about it a couple of days ago, i'm fine with that
<_zack> so, you propose to actually drop him from the copyright owners?
<_zack> or else we can change the license and be done with that
<_zack> I'd prefer the latter
Narrenschiff has quit []
<mrvn> kaustuv: should just be color or glow.
Mr_Awesome has joined #ocaml
<rwmjones> I'm going to post on caml-list now
<_zack> ok
<_zack> rwmjones: did you tag?
<rwmjones> ah no, let me do that too
<_zack> then you'll need a push --tags (dumb git!)
<rwmjones> _zack, any particular tag name?
<_zack> "1.0" ?
<rwmjones> ok, I think I did that
<_zack> got it
ched_ is now known as Ched
Ched is now known as Cheed
Snark has joined #ocaml
rapha_ has joined #ocaml
rapha__ has joined #ocaml
rapha_ has quit [Read error: 104 (Connection reset by peer)]
j_lenorm has joined #ocaml
<j_lenorm> ok
jonafan_ is now known as jonafan
<j_lenorm> so I've installed tcl/tk into ~/lib
<j_lenorm> and I've told godi.conf to look into ~/lib
<j_lenorm> when installing godi says:
<j_lenorm> here's my godi.conf:
<j_lenorm> anyone have any ideas?
<j_lenorm> oh my
<j_lenorm> nevermind
ygrek_ has joined #ocaml
ygrek_ has quit [Remote closed the connection]
ygrek has quit [Remote closed the connection]
ygrek_ has joined #ocaml
<j_lenorm> actually, it doesn't work
<j_lenorm> anyone have any ideas?
petchema has quit [Read error: 110 (Connection timed out)]
<j_lenorm> oh, you need 8.0
<j_lenorm> lordy
<j_lenorm> that's pretty whack
* j_lenorm hopes whack isn't considered vulgar
<j_lenorm> whew, it works!
<_zack> rwmjones: just read the announcement, thanks!
Narrenschiff has joined #ocaml
Alpounet has joined #ocaml
petchema has joined #ocaml
<j_lenorm> anyone know how to disable the opengl part of lablgtk2?
rapha__ has quit []
<_zack> rwmjones: I've set up a minimal web page, it would be cool to add a couple of example usages
<_zack> I've just made available the ocaml.m4.html for the moment ...
<_zack> (hint, hint)
<rwmjones> yeah I was just doing an example actually
<hcarty> j_lenorm: godi_console -> Select souce package -> lablgtk2 -> configure -> use gl = no
<j_lenorm> hcarty: yay!
<j_lenorm> thx
<j_lenorm> double yay!
<hcarty> j_lenorm: Glad that it's working
OChameau has quit [Read error: 113 (No route to host)]
<j_lenorm> ugh, now installing gtk+ is a pain and a half!
* j_lenorm kills the admin
slash_ has joined #ocaml
<kaustuv> Why is Xavier Leroy calling Xah Lee a troll in <49D2455A.1070802@inria.fr> ?
itewsh has joined #ocaml
<j_lenorm> he's moved to china I think
<j_lenorm> don't quote me on that
schmx has quit ["leaving"]
<flux> kaustuv, possibly you should follow comp.lang.functional
<flux> although I'm not of the opinion that Xah Lee is a troll, albeit he must be a personality
<flux> but apparently he has self claimed to be a troll in his web site, I remember that being mentioned :)
<flux> (many others are of that opinion)
<kaustuv> flux: thanks. I stopped reading c.l.f. in 2000 and he wasn't active then.
Snark has quit [Read error: 113 (No route to host)]
ttamttam has joined #ocaml
j_lenorm has quit [Read error: 104 (Connection reset by peer)]
siloxid has joined #ocaml
komar_ has quit [Read error: 113 (No route to host)]
ygrek_ has quit [Remote closed the connection]
Camarade_Tux has quit ["Leaving"]
ttamttam has left #ocaml []
ttamttam has joined #ocaml
<mrvn> method set_next : vbase option -> unit
<mrvn> How do I say that set_next can take 'a option as long as 'a matches class type vbase?
rhar has joined #ocaml
ttamttam has left #ocaml []
<Alpounet> rwmjones & zack > great job :)
<flux> mrvn, you mean a supertype will do?
<flux> mrvn, are you sure you want to do that? because that polymorphicity will appear either in the object type or in a forall-quantifier of the method..
<flux> (while the caller can do foo#set_next (bar :> vbase))
<_zack> Alpounet: cheers
<mrvn> flux: I want "foo#set_next bar" to work without needing a cast
<mrvn> flux: I want to move the (bar :> vbase) into the class away from the caller.
<flux> maybe this is then for you: class type vbase = object method set_next : 'a . 'a -> unit constraint 'a = #vbase end;;
<flux> I'm not sure if I got it right, I haven't really used constraints
<flux> atleast the outputted type doesn't seem right :-o
<flux> nope, that's not it then.. I wonder how to express it then :)
<mrvn> Should that even compile without defining a class type vbase first?
<mrvn> I pasted just that line into a toplevel and it didn't complain.
<flux> oh, right, I redefined vbase there
<mrvn> must work recursively.
<flux> but the thing is that constraint isn't sticking :)
<flux> the more obvious way (in my thinking) would be class type foo = object method set_next : 'a . (#foo as 'a) -> unit end, but that doesn't compile
<flux> Error: This type scheme cannot quantify 'a :it escapes this scope."
<flux> maybe the error message is a clue :)
<flux> ahha, it may have something to with the fact that the type isn't fully defined yet
<mrvn> I was thinking object('self) and use 'self
<flux> this works: type vbase_ype = < set_next : 'a. (#vbase_type as 'a) -> unit >
<mrvn> but that wouldn't inherit right
<flux> but I'm unsure how to express that with 'class' syntax..
<mrvn> # type vbase_type = < set_next : 'a. (#vbase_type as 'a) -> unit >;;
<mrvn> Error: Unbound class vbase_type
<flux> pft, foiled by previous definitions in toplevel
<mrvn> your type if refering to the previously defined class
<flux> for me that is
_andre has quit ["leaving"]
<mrvn> Error: This expression cannot be coerced to type vbase = vbase; it has type
<mrvn> Types for method set_next are incompatible.
<mrvn> This simple coercion was not fully general. Consider using a double coercion.
<mrvn> does that mean I have to coerce to ['a] vbase2 first?
<_zack> mrvn: double means using the "a : t1 :> t2" syntax
<mrvn> so (self : 'self :> vbase), hmm, Self type cannot be unified with a closed object type
<_zack> meaning "a, which is of type t1, should be coerced to t2"
komar_ has joined #ocaml
<mrvn> but is expected to have type 'b. 'b option -> unit
<mrvn> grr. Now I have the problem of the constraint not sticking too.
<mrvn> 'b option -> unit constraint 'b = #vbase => The method set_next has type (#vbase as 'a) option -> unit where 'a is unbound
<mrvn> 'b. (#vbase as 'b) option -> unit => Error: This type scheme cannot quantify 'b : it escapes this scope.
<flux> maybe you can ask from the ml :)
<flux> or wait mfp to get around :)
<mrvn> looks like the type system can't express this.
<flux> which is funny, because a normal function can do it
<flux> there might be some syntax we're missing
<mrvn> how do you write it for a function?
<flux> let foo_doit (a : #foo) = a#set_next (a :> foo)
<mrvn> class type vbase = object method set_next : 'a. 'a option -> unit constraint 'a = #vbase end;;
<mrvn> class base : vbase = object method set_next : 'a. 'a option -> unit constraint 'a = #vbase = function _ -> () end;;
<mrvn> That gives me a syntax error on "constraint"
<flux> you need to lift constraint after the function definition. or, possibly before. and this is telling me that it might be outside the scope of that 'a.'a..
<mrvn> without constraint it compiles but that isn't the right type then
<flux> but I'm off to sleep
hkBst has joined #ocaml
<mrvn> class type virtual vbase = object method virtual set_next : 'a. 'a option -> unit constraint 'a = #vbase end;;
<mrvn> class virtual base : vbase = object method virtual set_next : 'a. 'a option -> unit constraint 'a = #vbase end;;
<mrvn> class base2 = object inherit base method set_next _ = () end;;
<mrvn> # b#set_next (Some 1);;
<mrvn> - : unit = ()
<mrvn> That violates the constraint.
<mrvn> I think this is a bug in ocaml. The constraint should not vanish.
<Alpounet> Soon, I'll bring here an OCaml toplevel bot... are you okay for that ?
psnively has joined #ocaml
<_zack> rwmjones: do you mind if I check in your example content into ocaml-autoconf under examples?
<_zack> rwmjones: actually, your blog post can become a README file in that dir too
<mrvn> _zack: any clue about constraints in polymorphic methods?
Alpounet has quit ["Ex-Chat"]
seafood has joined #ocaml
Camarade_Tux has joined #ocaml
komar_ has quit [Remote closed the connection]
petchema has quit [Read error: 110 (Connection timed out)]
petchema has joined #ocaml
itewsh has quit ["There are only 10 kinds of people: those who understand binary and those who don't"]
_zack has quit ["Leaving."]
psnively has quit []
siloxid has left #ocaml []
Narrenschiff has quit []
Narrenschiff has joined #ocaml
willb has quit [Read error: 110 (Connection timed out)]
Prael has joined #ocaml
Narrenschiff has quit []
Camarade_Tux has quit ["Leaving"]
hkBst has quit [Read error: 104 (Connection reset by peer)]