gildor changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 3.12.1 http://bit.ly/nNVIVH
<pippijn> thelema: Pen.t is an argument to a virtual method in the widget class
<thelema> if you need a Pen.t as an argument, you'll have to cast, then.
<thelema> Your widget class?
<pippijn> and Pen.t provides functionality, as well
<pippijn> not just an interface
<pippijn> the widget class has a method paint : Pen.t -> unit
larhat1 has quit [Quit: Leaving.]
<thelema> can you change the input type?
<pippijn> yes, my widget class
avsm has quit [Quit: Leaving.]
<thelema> normally you mean Pen.t -> unit, but in ocaml, there's a better type that just indicates the required methods and their type
<pippijn> do I have to write it down somewhere or can I construct it from Pen.t?
<thelema> can you remove whatever explicit type declaration you're using?
iago has quit [Ping timeout: 260 seconds]
<thelema> OCaml doesn't infer object types
<thelema> well, not named object types
<pippijn> ah
<pippijn> anyway, I need a coercion somewhere
<pippijn> I don't know where the right place for it is, yet. I will find that, later
<pippijn> now I have another question
<pippijn> http://paste.xinu.at/QR2t/ <- Frame module
<pippijn> don't pay attention to the incorrect code at the bottom
<pippijn> I find this code quite ugly
<pippijn> the problem is that pen is immutable
<pippijn> pen#write returns a new pen with an updated position
<thelema> why is that a problem?
<pippijn> line 29
iago has joined #ocaml
<pippijn> actually 30 and 31
<pippijn> I just think they are ugly..
absalon has joined #ocaml
<pippijn> any ideas on how to make it look nicer?
<thelema> yes, I agree that it's ugly. what does #write return?
<pippijn> a pen
<pippijn> with updated position (x + 1 in this case, 1 = length ".")
<thelema> ah, ok
absalon has quit [Client Quit]
<pippijn> flux: constraint solver test
<pippijn> flux: result: screen_w=80 screen_h=25 win1_x=0 win1_y=0 win1_w=40 win1_h=25 win2_x=42 win2_y=0 win2_w=38 win2_h=25
zuymanto has quit [Quit: zuymanto]
<pippijn> I think I'm going to have a lot of fun with this constraint solver, also outside my game
<pippijn> outside my widget toolkit
gmcabrita has quit [Remote host closed the connection]
bobry has quit [Remote host closed the connection]
joewilliams has quit [Remote host closed the connection]
IbnFirnas has quit [Read error: Connection reset by peer]
svenl has quit [Read error: Operation timed out]
lopex has quit [Remote host closed the connection]
IbnFirnas has joined #ocaml
svenl has joined #ocaml
joewilliams has joined #ocaml
lopex has joined #ocaml
iago has quit [Quit: Leaving]
bjorkintosh has quit [Ping timeout: 244 seconds]
bobry has joined #ocaml
tautologico has quit [Quit: tautologico]
Tobu has quit [Remote host closed the connection]
Tobu has joined #ocaml
tmaedaZ is now known as tmaeda
emmanuelux has quit [Ping timeout: 264 seconds]
r126f has quit [Ping timeout: 244 seconds]
r126f has joined #ocaml
ulfdoz has joined #ocaml
Tobu has quit [Ping timeout: 272 seconds]
Tobu has joined #ocaml
ulfdoz has quit [Ping timeout: 248 seconds]
<flux> pippijn, nice
jbapple has joined #ocaml
<jbapple> I'm having some trouble with polymorphic variants and polymorphic recursion
<jbapple> Or, I think polymorphic recursion is what my problem is
<jbapple> I can't figure out how to annotate the function flip to make it accept arguments of type qux
<jbapple> Here's a version with the error message in it: http://pastebin.com/vDwjJHME
<jbapple> I've tried annotating flip in a few different ways:
<jbapple> I tried the example from "Programming with Polymorphic Variants" section 3.2.3: "let rec flip : (qux as 'a) -> 'a = fun x ->"
<jbapple> That gives me an error on the function definition, on "flip z": "This expression has type qux but an expression was expected of type foo"
<jbapple> This makes me think it's a polymorphic recursion issue. It feels like the type of flip is getting set at "flip y"
<jbapple> Since if I change the definition of qux to "type qux = [`muk of qux * foo|foo]", the error is the same but with the type names reversed
<jbapple> I also tried some double coercions as in the Caml Weekly News of 1 July 2003: http://lwn.net/Articles/38468/
ankit9 has joined #ocaml
struktured has joined #ocaml
<jbapple> I've also tried using Explicit polymorphic type annotations http://caml.inria.fr/pub/docs/manual-ocaml/manual021.html#toc79
<jbapple> Using types like 'a . ([>qux] as 'a) -> 'a
<jbapple> This produces strange errors like: Error: This pattern matches values of type [< `bar | `baz | `muk of 'a * 'b ] but a pattern was expected which matches values of type [> qux ] The second variant type does not allow tag(s)
<jbapple> Which confuses me - this error usually lists what tag(s) are not allowed
<jbapple> But here it seems to think said list of tags is empty
ggherdov has joined #ocaml
ftrvxmtrx has quit [Quit: Leaving]
fantasticsid has joined #ocaml
pango is now known as pangoafk
Tobu has quit [Ping timeout: 272 seconds]
Tobu has joined #ocaml
Tobu has quit [Changing host]
Tobu has joined #ocaml
larhat has joined #ocaml
Cyanure has quit [Ping timeout: 246 seconds]
Cyanure has joined #ocaml
tufisi has joined #ocaml
ftrvxmtrx has joined #ocaml
cago has joined #ocaml
mika1 has joined #ocaml
ggherdov has quit [Remote host closed the connection]
sgnb has joined #ocaml
Cyanure has quit [Remote host closed the connection]
thomasga has joined #ocaml
ankit9 has quit [Quit: Leaving]
cago has quit [Quit: Leaving.]
djcoin has joined #ocaml
hto has joined #ocaml
Cyanure has joined #ocaml
cago has joined #ocaml
<djcoin> Does any Ocaml project have been submitted/accepted for Google Summer of Code ?
<Ptival> djcoin: doesn't look like there was
<rixed> although there were for Haskell, Scala, and a few other FPlangs.
<Ptival> yes
<rixed> I don't remember having seen some proposals, though. Maybe next year the community should think about it?
<Ptival> Inria is probably not going to make the effort, but some other organizations could potentially
<djcoin> Yep
<Ptival> (OCamlcore, OCamlpro, Jane St., IRILL, etc.)
<rixed> Ptival: of course I was not thinking about inria :*) rather ocamlpro
<rixed> There were some GSoC in the past related to OCaml IIRC.
<rixed> Supervised by Jane St.....
<rixed> let me look...
fantasticsid has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
<Ptival> Gabriel Scherer made up a list of things we would like to see done, maybe the remainder of the list can be turned into GSoC proposals next year... this will need mentors though
<rixed> No it was not GSoC but Jane Street Summer Project :)
<Ptival> oh right, they have their own thing going onj
avsm has joined #ocaml
<rixed> Ptival: where's that list?
<Ptival> not public yet
<Ptival> (because not finished yet)
<thomasga> I guess ocamlpro could mentor GSoC projects
<thomasga> just need to see what that means in practice
<adrien> lots of work
<thomasga> if someone is interested in that, we can at least discuss to understand how much work
<avsm> too late for this year
<thomasga> ok
<adrien> but find some people who've mentored and talk to them; or at least some blog or mailing-list posts
Kakadu has joined #ocaml
<reynir> I wanted to participate in gsoc, but I was a week or two too late :/
zuymanto has joined #ocaml
bacam_ has joined #ocaml
bnwr_ has joined #ocaml
alp_ has joined #ocaml
ztfw` has joined #ocaml
j2d2j2d2_ has joined #ocaml
bnwr has quit [Ping timeout: 246 seconds]
bacam has quit [Ping timeout: 246 seconds]
j2d2j2d2 has quit [Ping timeout: 246 seconds]
pr0zac has quit [Ping timeout: 246 seconds]
ztfw has quit [Ping timeout: 246 seconds]
alpounet has quit [Ping timeout: 246 seconds]
chambart has quit [Ping timeout: 246 seconds]
alp_ is now known as alpounet
pr0zac has joined #ocaml
bnwr_ is now known as bnwr
roha has joined #ocaml
chambart has joined #ocaml
Tobu has quit [Ping timeout: 272 seconds]
Tobu has joined #ocaml
<Ptival> gildor_: oh, good to know
<gildor_> but I doubt that any project backed by a commercial company (ex-OCamlCore, OCamlPro, Jane St) will get a GSoC
<adrien> didn't AdaCore get something?
<gildor_> GSoC is more about community effort that cannot get money otherwise
<gildor_> adrien: no AdaCore in the accepted mentoring organization since 2009
<adrien> ok, my bad
<gildor_> adrien: I am not 100% sure, it is just that I really doubt OCamlPro can be a mentoring org
<gildor_> adrien: an as far as I understand the feedback we got from GSoC, we had with C. Troestler, anyone that want to re-apply as a GSoC mentoring organization, should reuse the project on the forge
<gildor_> adrien: because how long you have been trying to get a GSoC matters
<gildor_> adrien: or you should apply for a more focused GSoC (e.g. batteries, oasis, ocsigen)
<gildor_> adrien: at least a project that has dozens of commiters and a living mailing list
munga has joined #ocaml
<gildor_> Ptival: ^^^ (all what has been said to adrien)
<avsm> gildor_: huh? xen has mentored several years, despite being commercially backed
<avsm> ocaml certainly fits... just needs to pass their other criteria
<gildor_> avsm: it was labelled Xen.org and starts with "Xen.org is an open source community"
<gildor_> avsm: I just say that it won't have been possible for, e.g., OCamlCore itself to be a mentoring organization
<gildor_> (or Jane Street, maybe INRIA can make the cut)
hcarty has quit [Ping timeout: 245 seconds]
hcarty has joined #ocaml
bacam_ is now known as bacam
<gildor_> that is not a question of the organization, but more a question that Google should not pay someone (i.e. mentor) that is part of a commercial org without looking to create a contract with this commercial org.
<gildor_> i.e. lawyer stuff
<gildor_> avsm: ^^
<gildor_> avsm: BTW, I doubt Citrix can apply for a GSoC
<gildor_> (I think a lawyer will say "don't create a formal bound")
mfp has joined #ocaml
<gildor_> mfp: upgraded sqlexpr yesterday
<gildor_> mfp: no more need for a Lwt_pool if I understand correctly
<avsm> gildor_: we mentored well before xen.org, as Xensource
<avsm> and mentors dont get paid, only students (who aren't part of the commercial org)
<mfp> gildor_: it's been a while, but I guess you're referring to Sqlexpr_sqlite_lwt. It uses an internal thread pool to avoid blocking on calls to sqlite3's API.
<gildor_> avsm: seems like there are smthg like a $500 for mentoring, but we don't reach that stage with our previous attempt, so maybe I am wrong
avsm has quit [Quit: Leaving.]
<gildor_> avsm: concerning commercial org, I think that maybe Xen was considered extremly important, whereas OCaml will not
<mfp> for some reason, ocaml-sqlite3's handles must be used from the same thread that created them, so I couldn't just use Lwt_preemptive over a pool of handles
roha has quit [Remote host closed the connection]
<f[x]> mfp, why?
<f[x]> what happens if you violate that?
<f[x]> afaik the sqlite3 constraint (in default build mode) is a reasonable "one thread at a time using handle"
Hussaind has joined #ocaml
<mfp> f[x]: quoting from sqlite3.mli: "type db [...] NOTE: DO NOT USE THIS HANDLE WITHIN THREADS OTHER THAN THE ONE THAT CREATED IT!!!"
<mfp> with that much emphasis being put on this, the least I'd expect is a segfault, but I'd better not try
<f[x]> I see
<f[x]> maybe that was left from the old dark ages when sqlite had such limitation by itself
<f[x]> I don't see any thread-local usage in the stubs
<gildor_> when avsm will be back, adrien and Ptival: ok, read more closely docs, commercial org can be a mentoring org, the product must be licensed under OSI approved license
The_third_bug has quit [Ping timeout: 248 seconds]
<gildor_> so I was wrong, though it is probably a little bit harder for commercial org
The_third_bug has joined #ocaml
* gildor_ need to work now, bye bye
cago has quit [Quit: Leaving.]
lihaitao has joined #ocaml
ztfw` is now known as ztfw
zuymanto has quit [Quit: zuymanto]
zuymanto has joined #ocaml
Kakadu has quit [Quit: Page closed]
zuymanto has quit [Quit: zuymanto]
_andre has joined #ocaml
hyperboreean has quit [Ping timeout: 245 seconds]
hyperboreean has joined #ocaml
eni has joined #ocaml
eni has quit [Ping timeout: 245 seconds]
avsm has joined #ocaml
cago has joined #ocaml
ankit9 has joined #ocaml
Submarine has joined #ocaml
struktured has quit [Remote host closed the connection]
struktured has joined #ocaml
Tobu has quit [Ping timeout: 260 seconds]
gmcabrita has joined #ocaml
Tobu has joined #ocaml
eni has joined #ocaml
BiDOrD_ has joined #ocaml
gnuvince has quit [Ping timeout: 250 seconds]
BiDOrD has quit [Ping timeout: 246 seconds]
<gildor_> avsm (FYI): ok, read more closely docs, commercial org can be a mentoring org, the product must be licensed under OSI approved license
rossberg has quit [Ping timeout: 260 seconds]
rossberg has joined #ocaml
roha has joined #ocaml
mfp has quit [Read error: Connection reset by peer]
oriba has joined #ocaml
rixed has quit [Ping timeout: 245 seconds]
ankit9 has quit [Ping timeout: 260 seconds]
rixed has joined #ocaml
mfp has joined #ocaml
ankit9 has joined #ocaml
everyonemines has joined #ocaml
gnuvince has joined #ocaml
struktured has quit [Ping timeout: 265 seconds]
fraggle_laptop has joined #ocaml
emmanuel__ has joined #ocaml
saml has joined #ocaml
gnuvince has quit [Ping timeout: 248 seconds]
tmaeda is now known as tmaedaZ
gnuvince has joined #ocaml
smondet has quit [Ping timeout: 248 seconds]
oriba has quit [Quit: oriba]
Anarchos has joined #ocaml
Anarchos has quit [Client Quit]
tmaedaZ is now known as tmaeda
lihaitao has quit [Quit: Ex-Chat]
Submarine has quit [Quit: Leaving]
Cyanure has quit [Remote host closed the connection]
eni has quit [Ping timeout: 260 seconds]
smondet has joined #ocaml
ulfdoz has joined #ocaml
oriba has joined #ocaml
bkheops has joined #ocaml
eni has joined #ocaml
<hcarty> diml: I have started getting EINTR exceptions during zeromq calls under Lwt. Is it possible that Lwt is causing these?
<hcarty> diml: I'm not sending any signals myself that I know of.
<bkheops> hello, I want to get a side-effect in a string or in a buffer. For example : "print_int 5" , result is unit, side effect print 5 on the top level but I want 5 in a variable.
<bkheops> *print_int 5
<mrvn> bkheops: Printf.sprintf "%d" 5
<hcarty> bkheops: or string_of_int
<mrvn> yeah, depending on wether you just want the int or more.
<thelema> If you want arbitrary printing to a buffer, you can use batteries' BatIO which has a full printing system that can go to string, buffer, Unix.channel, Pervasives.channel, and more
<flux> to me it sounds like he wants to put functions into a buffer?-o
<diml> hcarty: lwt does not send signal either
<bkheops> ok, it was a bad example^^, i use Curl binding and I want to get response in a variable :). I think I can use what you says thelema
<hcarty> diml: I didn't think so. Thanks.
<hcarty> bkheops: Yes, Batteries' IO system or you can use the Buffer module
<hcarty> bkheops: I've done the same thing. I think the OCaml libcurl bindings come with an example showing how to do this.
<thelema> bkheops: if you're lazy, you redirect curl's output to a file and just open that file
<flux> ah, right, I misunderstood
<bkheops> yes I'm ! lol. I will try 2 solutions. Thank's guys !
<f[x]> that example would really benefit from setting some timeouts
<bkheops> hcarty : exactly what I want !
<hcarty> bkheops: But take f[x]'s recommendation/warning or you could end up with stalled downloads that never quit :-)
j2d2j2d2_ is now known as j2d2j2d2
ankit9 has quit [Ping timeout: 240 seconds]
oriba has quit [Quit: oriba]
andreypopp has joined #ocaml
bumb has joined #ocaml
bumb has quit [Quit: bumb]
<mrvn> I want to move parts of one big file into its own file. Any suggestions how to do that so that git keeps the history intact for the moved stuff?
philed has joined #ocaml
<adrien> git can notice that to some extent
<adrien> maybe try and see how well it manages
<adrien> (maybe it'll do better if you do it in several commits)
<adrien> but you won't keep the history
<mrvn> I was thinking maybe first copy the whole file and then cut them both down in a second commit.
<mrvn> For the new file it would then look like a rename + lots of deletion
cago has quit [Quit: Leaving.]
<rixed> mrvn: git will figure it out, give it a try.
mika1 has quit [Quit: Leaving.]
philed` has joined #ocaml
ankit9 has joined #ocaml
ulfdoz_ has joined #ocaml
<hcarty> diml: Any idea why I would get an (unhandled) EINTR on "readable"? Again, Lwt's prevention of complete backtraces makes this difficult to track down.
philed has quit [Ping timeout: 272 seconds]
munga has quit [Ping timeout: 244 seconds]
ulfdoz has quit [Ping timeout: 265 seconds]
ulfdoz_ is now known as ulfdoz
<rixed> hcarty: there was a bug like this in some versions of lwt some time ago... like in 2.0 or so.
<diml> hcarty: it has been fixed in the development version
<hcarty> diml: Backtraces? That's wonderful news :-)
ftrvxmtrx has quit [Quit: Leaving]
<diml> hcarty: no, the handling of EINTR on readable
<mrvn> rixed, hcarty: doesn't work. Not even if I copy the file completly.
<hcarty> diml: Ah, ok. Is there a workaround that I can apply until then?
<hcarty> mrvn: That's unfortunate. I haven't tried it myself, but I had read about the "git gui blame" command
<hcarty> .
<diml> hcarty: no, you have to patch lwt
<mrvn> cp tiles.ml unit.ml; git add unit.ml; git commit unit.ml; git blame unit.ml
avsm has quit [Quit: Leaving.]
<mrvn> All lines appear to be freshly created.
<hcarty> mrvn: From the SO post, it sounds like the gui is the only means to show the history.
<mrvn> hcarty: what gui? qgit doesn't.
<hcarty> git gui blame
<mrvn> git: 'gui' is not a git command. See 'git --help'.
<hcarty> "git gui blame unit"
<hcarty> mrvn: Ah, then you don't have it compiled/installed
<hcarty> mrvn: I tested it here and the annotation works
<mrvn> same here. why doesn't git blame show the same?
<hcarty> I don't know, but it would be really nice if it did
<diml> mrvn: you can try git blame -C
<rixed> mrvn: mv NEWS OLDS; git add OLDS; git rm NEWS; git commit -m 'test'; then gitk shows: rename NEWS->OLDS (and so does git status before the commit)
<rixed> mrvn: although I don't know how to get the information from git gui, which I'm not used to.
larhat has quit [Quit: Leaving.]
<hcarty> diml: That looks like it does it, or at very least something close.
<mrvn> rixed: I know.
<mrvn> Wow, it even gets that the indentation changed because I moved a submodule into its own file.
<mrvn> But only on unit.ml, not item.ml. Probably because item.ml is really short.
<rixed> there are various heuristics implemented here and there in git tools that will detect (or not) such moves. git database itself does not stores this info. but this works quite well in practice.
<mrvn> rixed: I think that sucks. git should realy have a mv and copy thingy.
<rixed> mrvn: other VCS I know does this for rename only, which is not enough in practice. I'd rather have strong heuristics able to detect I moved a subset of a file than a whole or nothing thing. But I'm sold to git ;)
<mrvn> rixed: Nothing wrong with a good heuristic. But I know what I'm doing. No need to guess. I should be able to tell git what I did and have git store that information.
<jaxtr> ahh it's a wonderful day
<Hodapp> Also, Linus totally flamed the hell out of someone on the Git mailing list for suggesting it should be written in C++ instead of C, and the discussion is hilarious.
Submarine has joined #ocaml
<mrvn> jaxtr: The burning sunlight, the oxidizing fresh air und the noise pollution from the song birds?
<mrvn> Hodapp: obviously git should be written in ocaml.
<hcarty> mrvn: One can only assume that was the outcome of the mailing list discussion.
philed`` has joined #ocaml
philed` has quit [Ping timeout: 272 seconds]
ftrvxmtrx has joined #ocaml
<Hodapp> mrvn: Isn't there a source control system written in OCaml? Maybe Darcs?
<Hodapp> a similarly-designed one at that
djcoin has quit [Quit: WeeChat 0.3.2]
bkheops has quit [Remote host closed the connection]
tmaeda is now known as tmaedaZ
sivoais has quit [Ping timeout: 265 seconds]
emmanuel__ has quit [Quit: @+]
avsm has joined #ocaml
<hcarty> Hodapp: darcs is written in Haskell
tmaedaZ is now known as tmaeda
<Hodapp> close enough.
Snark has joined #ocaml
* Hodapp ducks
hiptobecubic has joined #ocaml
fraggle_laptop has quit [Remote host closed the connection]
<Hodapp> oooh
emmanuelux has joined #ocaml
<hcarty> diml: If a system call wrapped by Lwt_unix.wrap_syscall gets an EINTR, should this be passed back to Lwt?
<hcarty> diml: I'm not sure if it could be triggered by another thread managing an external process.
<pippijn> flux: made of this: http://paste.xinu.at/rvp/ocaml
<flux> pippijn, looks nice
<diml> hcarty: yes, EINTR is handled like EAGAIN
<diml> and unix signals are delivered by the kernel to a thread at random
pangoafk has quit [Remote host closed the connection]
f[x] has quit [Ping timeout: 272 seconds]
pango has joined #ocaml
pr0zac has quit [Changing host]
pr0zac has joined #ocaml
sivoais has joined #ocaml
<hiptobecubic> How does OOP and immutability fit together?
<pippijn> changing an object state = creating a new object
<hiptobecubic> thanks
<hiptobecubic> I assume that's handled cleverly by the compiler to avoid massive amounts of duplication somehow?
<flux> you don't need to copy much if te rest of the stuff keeps the same
sivoais has quit [Ping timeout: 252 seconds]
sivoais has joined #ocaml
<_habnabit> OOP and immutability fit together _brilliantly_
<_habnabit> mutation is a curse
<Hodapp> _habnabit: Why brilliantly?
<mrvn> hiptobecubic: Not at all. the compiler simply duplicates when you tell it to duplicate.
<_habnabit> why not? the idea of having objects with methods is great
<Hodapp> _habnabit: objects with methods isn't really OOP...
<_habnabit> it isn't ???
<Hodapp> the emphasis put on it by the guy who invented the paradigm in the first place is on the message passing, not the objects
<_habnabit> okay, so
<Hodapp> to the extent that he didn't like it being called "object-oriented" because people were focusing so much on the objects and ignoring the messaging
<Hodapp> and rather regretted choosing that term
<hiptobecubic> well it's a bit stupid to call it "object oriented" and then be upset when people assume it's oriented around working with objects.
<hiptobecubic> ocaml stuff doesn't seem to handle "make -jN" very well
<hiptobecubic> at least, wyrd fails and ocamlc fails
<_habnabit> hiptobecubic, you're not using ocamlbuild?
<hiptobecubic> I didn't write this software.
<hcarty> hiptobecubic: That's more of a 'feature' of the Makefile than the language
<hiptobecubic> well i suppose the dependencies aren't properly mapped out then
<hcarty> If the Makefile isn't structured to be -jN friendly then it doesn't really matter what the underlying language is.
<hiptobecubic> very true
sivoais has quit [Quit: Lost terminal]
sivoais has joined #ocaml
junsuijin has joined #ocaml
junsuijin has quit [Client Quit]
<Hodapp> hiptobecubic: Alan Kay was not concerned so much with the focus on objects, but more on how 'object' in general became such a watered-down term that was used to the exclusion of messaging, which he felt was at as much or higher importance to the notion of an object.
<everyonemines> he probably didn't mean for this to happen: http://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html
ankit9 has quit [Ping timeout: 260 seconds]
<Hodapp> hiptobecubic: In addition to this, he defined it as referring to "only messaging, local retention and protection and hiding of state-process, and extreme late-binding of all things."
<Hodapp> encapsulation (as is often the purpose of objects + methods), polymorphism, and inheritance are really kind of orthogonal to all that
<Hodapp> and really the way he defined it is now a bit closer to agent-oriented programming than modern OOP is
<Hodapp> everyonemines: was that to me?
<everyonemines> just a comment on OO not ending up as Kay intended
<Hodapp> is anything in Java the way anyone intended?
<Hodapp> well, I guess it's almost the way everyone intended, which is part of its problem.
<pippijn> hiptobecubic: to avoid copying a lot of data, keep your functional objects small
<pippijn> hiptobecubic: if you have 200 int members in your object, then copying it will copy all 200 int values
<pippijn> hiptobecubic: but if you organise those 200 int members in sub-objects, then only the pointers to those sub-objects are copied
skchrko has joined #ocaml
ankit9 has joined #ocaml
<everyonemines> or you could use array refs
<everyonemines> * arrays or refs
<Hodapp> everyonemines: that is quite an interesting article.
<pippijn> arrays are mutable
<everyonemines> so?
smerz has joined #ocaml
Hussaind has quit [Remote host closed the connection]
<hcarty> everyonemines: Indeed - thanks for sharing the link
<everyonemines> :-)
<hcarty> OCaml's objects support functional updates, so you don't need to copy (much of) anything.
<Hodapp> what are 'functional updates'?
ulfdoz has quit [Ping timeout: 245 seconds]
<hcarty> Hodapp: If an object has 200 attributes and you want a new object with only two of those changed, the other 198 will be shared between the objects
<hcarty> For records, the syntax is: let new_record = { original_record with field_x = new_value }
<hcarty> The syntax is similar for objects but I don't remember it off the type of my head. It's in the manual in the object section...
<hcarty> s/type/top/
<pippijn> hcarty: yes, shared, but the pointers to them are copied
<pippijn> hcarty: so with 200 ints, no sharing happens
<hcarty> pippijn: True. That's why it's not much copying, not no copying.
<pippijn> right
<hcarty> But in the case of ints, copying vs not copying doesn't really matter unless you break the type system.
<pippijn> expr_stmt a >>= (fun a -> expr_stmt b >>= (fun b -> Some (a +~ b)))
<pippijn> (>>=) here is BatOption.bind inverted
<pippijn> can I write this in a prettier wayß
<pippijn> ?
The_third_bug has quit [Read error: Connection reset by peer]
<mfp> let module Lwt = BatOption in lwt x = expr_stmt a in lwt y = expr_stmt b in Some (a +~ b) :-P
<pippijn> hah
<pippijn> yeah..
<pippijn> there should be a generic syntax extension for monads
<mfp> let! nearly made it
<pippijn> something that simply uses the >>= that's currently in scope
<mfp> IIRC it got shot down because of some problem with and bindings (but the need/use for it in Lwt is Lwt's thing, with it not being monadic and all)
<pippijn> by the way, I tried the lwt thing
<pippijn> just for fun
<pippijn> Error: This expression should not be a function, the expected type is
<pippijn> 'a option
<pippijn> http://paste.xinu.at/XeQ5/ <- this code
<pippijn> on line 3 it says that
zaltekk has joined #ocaml
everyonemines has quit [Quit: Leaving.]
thomasga has quit [Quit: Leaving.]
larhat has joined #ocaml
<pippijn> flux: http://paste.xinu.at/D1v/ <- now with "parent"
Snark has quit [Quit: Quitte]
Zedrikov has joined #ocaml
skchrko has quit [Quit: ChatZilla 0.9.88.2 [Firefox 12.0/20120423211717]]
_andre has quit [Quit: leaving]
Submarine has quit [Quit: Leaving]
<mrvn> Hmm, this is disapointing: computing a distance map: 6.369427 per second, 0.157000 seconds each, A*: 14.084507 per second, 0.071000 seconds each.
oriba has joined #ocaml
<mrvn> If I need a goto for 1-2 units then A* is faster but 3+ a full distance map is better. At least for longer paths.
<mfp> pippijn: Option.bind is inverted :-/
hiptobecubic has quit [Ping timeout: 245 seconds]
<mrvn> someone wants to implement a Delaunay triangulation for me?
<hcarty> mrvn: Yes
<hcarty> mrvn: One moment...
<hcarty> Done!
<Qrntz> impressive…
<mrvn> hcarty: and the function is where?
<hcarty> There is a Delaunay module
<hcarty> I haven't used it before, but it should provide what you need
<hcarty> mrvn: http://ocamlgraph.lri.fr/doc/Delaunay.Float.html -- this probably is what you want
<hcarty> Or one of the other modules at that level
<mrvn> yeah. Problem is I need the intermediate structure used to lookup which triangle a point belongs to, too.
eni has quit [Quit: Leaving]
<_habnabit> iter_triangles ?
<mrvn> No. One of the algorithms to create the triangulation creates a tree of triangle where you can find the triangle a point is inside of in O(log n).
horatio_cromwell has joined #ocaml
<pippijn> mfp: ah yeah..
<pippijn> mfp: that's why I had let (>>=) x f = Option.bind f x in
<thelema> pippijn: you may be pleased that batteries 2 has BatOption.Monad.bind with the arguments in monad order
horatio_cromwell has left #ocaml []
<pippijn> thelema: that's nice
<pippijn> thelema: I put http://paste.xinu.at/Ucs/ in my prelude.ml
<thelema> sadly the regular bind is still reverse order, and there's no >>+ operator
<thelema> err, >>=
<pippijn> now I can do: http://paste.xinu.at/xdBfjz/
<pippijn> instead of: http://paste.xinu.at/q8Kf/
<pippijn> but I don't think this is nice
<pippijn> what's wrong with "let!"?
<thelema> pippijn: iirc, syntax, the least of all reasons
<hcarty> Yes, method! and let! meaning two very different things was part of it
<pippijn> ok
<pippijn> lwt a = continue a
<pippijn> and b = continue b in
<pippijn> this works
<pippijn> it becomes this: http://paste.xinu.at/ui0OUb/ocaml
<hcarty> I think flexibility played a role as well. There was a question of what level of flexibility is required by users and libraries.
<thelema> not enough discussion as well.
<pippijn> is it still something I may hope for to someday exist?
<pippijn> is there a syntax extension for this, yet?
<thelema> yes
<thelema> no, afaik no syntax extension.
<hcarty> Does pa_monad do anything useful here? I've never used it, I only know something by that name exists.
<pippijn> maybe I can adapt the lwt one
<pippijn> to use the locally visible >>= instead of Lwt.bind
<pippijn> ah
<pippijn> hcarty: it's perform with <--
<pippijn> like haskell
<pippijn> that's nice
<pippijn> yep
<pippijn> hcarty: it does
<pippijn> I like it :)
<pippijn> now I just need to figure out how to make it play with ocamlbuild
roha has quit [Ping timeout: 260 seconds]
Zedrikov has quit [Quit: Bye all, see you next time!]
<pippijn> can oasis build syntax extensions?
<pippijn> never mind, pa_monad has a findlib META file
<mrvn> pippijn: yes and no. see extunix myocamlbuild.ml
<hcarty> oasis can build them, but it can't use them in programs from the same _oasis
<hcarty> Once a syntax extension is installed I'm pretty sure it can be used from oasis.
philed``` has joined #ocaml
<pippijn> thelema: batteries 1 also has the Monad
<pippijn> and I'm pleased
<thelema> oh, well then.
larhat has quit [Quit: Leaving.]
philed`` has quit [Ping timeout: 260 seconds]
<pippijn> I wonder what the advantage of the "with module Module in" form of pa_monad is vs. the "with Module.bind" form
saml has quit [Quit: Leaving]
uncharted_territ has joined #ocaml
<mrvn> anyone know of a module for a bidirectional map?
<mrvn> I need a map of (x, y) <-> dist
<mrvn> One using hashtbl preferably.
<thelema> mrvn: on my todo list (for the LRU cache in BatCsche
<pippijn> is it recommended to use named arguments to functions as much as possible?
<pippijn> I mean parameters, not arguments
<mrvn> pippijn: The stdlib usualy provides both
<pippijn> what's the disadvantage of using them?
philed``` has quit [Ping timeout: 252 seconds]
<pippijn> s/using/providing
<mrvn> # let f ~x ~y = x + y;;
<mrvn> val f : x:int -> y:int -> int = <fun>
<mrvn> # f 1 2;;
<mrvn> - : int = 3
<mrvn> Does the compiler generate better code without labels or why aren't they always used?
<mrvn> Or is it because the type gets longer because it includes the labels?
<mrvn> thelema: I was thinking of just using 2 Hashtbl.t. One forward and one backward. Problem is that removing (x, y)<->d needs to only remove that d from the second Hashtbl that maps to (x,y). The d is in no way unique.
<thelema> you can't do this if the keys in both tables aren't unique
<thelema> so what do you want the reverse lookup to return?
<mrvn> thelema: val find_all : ('a, 'b) t -> 'a -> 'b list
<thelema> eww, multimap in one direction?
<thelema> I guess you could do that.
<hcarty> mrvn: Partial application changes a bit if I recall correctly. It also affects your ability to pass functions around directly.
<mrvn> hcarty: you can do "f ~y:1". But is "f 1" or "f ~x:1" any different?
<thelema> mrvn: no difference
<hcarty> mrvn: If you have let f g x = g ~y:x then it makes a difference
<mrvn> Error: This expression has type x:int -> y:int -> int but an expression was expected of type int -> int -> int
<pippijn> mrvn: ah. there it is
<pippijn> that's why..
<mrvn> hmm, I would have thought that should work.
<pippijn> I would have, too
<thelema> yes, I wonder if there's a bug in mantis for this
<mrvn> # let g = (f :> (int -> int -> int));;
<mrvn> Error: Type x:int -> y:int -> int is not a subtype of int -> int -> int
<thelema> or a reason why it can't be done.
<hcarty> Labels don't affect code generation
<mrvn> That would be correct syntax, right?
<hcarty> At least not from the C binding point of view...
<Qrntz> this generates absolutely exact assembly
<Qrntz> well, the basic case we have here
<_habnabit> approximate assembly is a code smell anyway
<mrvn> How does f y:1 look like in memory?
<mrvn> Or more specific how does the closure know which slots for its arguments are filled and which pending?
<thelema> mrvn: probably some slight variant of a normal closure
<mrvn> I wonder wether it includes a lookup table from name to slot.
<mrvn> Then again: Error: This expression has type x:int -> y:int -> int but an expression was expected of type y:int -> x:int -> int
<thelema> probably not with any names, probably just positional
<mrvn> If it would use a lookup table then that could be allowed.
<thelema> nah, I bet it's just like records - the names just stand for positions
<mrvn> thelema: as in (f ~x ~y ~z) with y:1 gives [|0 2|] as indexes?
<thelema> possibly a bit-vector of what indexes are filled, and an array of filled values
<thelema> I'm just guessing, though.
<mrvn> thelema: bit-vector would limit it to x arguments.
<mrvn> unless it uses multiple values as needed
<thelema> well, I don't think you can get more named parameters until you've passed values for all existing ones, can you?
<mrvn> thelema: A function can have more than 32 parameters
<thelema> yes, but there's already special handling for functions with more than 5
<thelema> brb, ubuntu upgrade
thelema has quit [Quit: leaving]
<gildor_> pippijn: oasis can create and install (including META) syntax extension, but using it in the package you are building is a bit trickier, though not impossible
<gildor_> pippijn: basically you have to add CCOpt: -ppopt _build/src/pa_foo.cma and pray for this file to be created before you call it
<gildor_> (i.e. that the build order is good, even if you didn't specify it)
<pippijn> ah
<pippijn> I think I need to make separate packages, thought
<gildor_> but that is a work in progress. I create syntax extension myself and want to have something that works (TM) in the future, for my own use
<mrvn> gildor_: extunix adds a dependency on the pa_foo.cma file if I read the code correctly.
roha has joined #ocaml
<gildor_> mrvn: oh yes, this is not impossible to do, you just add to write extra things in myocamlbuild.ml -- like you will do without oasis
uncharted_territ has quit [Quit: Leaving]
<mfp> pippijn: this might interest you > http://www.nicollet.net/2011/12/two-way-bindings/
<pippijn> mfp: not bad
<pippijn> I'll keep that one bookmarked
<gildor_> ahhh, running oasis 0.1.0~alpha3 again (though it gives me an error that I need to solve when trying to upload packages)
<mrvn> mfp: Isn't that more a reverse binding than two-way?
<mrvn> mfp: let pattern = value in expression ===> (fun pattern -> expression) value, let! pattern = value in expression value (fun pattern -> expression). looks like the reverse.
<pippijn> I want this syntax: match foo with Module.({ a; b; }) -> ()
<mrvn> # let foo p = let P.({ x; y }) = p in x + y;;
<mrvn> Error: Syntax error
<mrvn> me too
<mrvn> Since let make x y = P.({ x; y }) works the other way around should work too.
struktured has joined #ocaml
<pippijn> yes
<pippijn> the problem is that P.(...) is an expression
<pippijn> but I think it should be allowed in a pattern
<mrvn> Why is that an expression? Should be more like a namespace.
<pippijn> it's like (let open P in ...)
<mrvn> P.({ x; y }) should be identical to { P.x; P.y }
<mrvn> pippijn: in the current implementation
<pippijn> it's not
<pippijn> it's identical to (let open P in { x; y })
<pippijn> but I agree, it should be
<_habnabit> urrrrrghhhhh. csv uses non-tail-recursive List.map
<mrvn> Write P.(match foo with ....)
<pippijn> mrvn: yes, not nice
<pippijn> you see my code?
<pippijn> let solve { width; height; } widget
<mrvn> Yeah. I still love the M.(...) syntax or let open .... Much better than opening stuff globaly.
<mrvn> should this work? let open Geometry.Concrete in let solve { width; height; } widget =
<mrvn> as in should it declare a global value solve?
<pippijn> mrvn: probably not
<pippijn> it would be a global expression
<mrvn> pippijn: I always () tuples. makes them more readable.
Cyanure has joined #ocaml
<pippijn> hmm
<pippijn> I don't :)
<pippijn> but I might change my mind in the future
<pippijn> I'm new to ocaml
<pippijn> the revised syntax requires it
mattrepl has joined #ocaml
<mrvn> Also means you don't accidentaly apply an argument to the last part of a tuple and putting the cursor on the ( or ) highlights the other.
<pippijn> ah
<pippijn> yes, the apply thing is true
<mrvn> let id x = x ... id, id y vs. (id, id) y
<pippijn> Hashtbl.fold (fun id var vars -> (id, var) :: vars) variables []
<mrvn> or that. Lots of places where you need () around tuples so best to always have them
<pippijn> ok, good arguments
<mrvn> but your choise. :)
<pippijn> I'm going to keep my style until it bites me enough
<mrvn> choice
<pippijn> I don't have a proper ocaml style, yet
<pippijn> in my C and C++ code, I have a very strict style
<pippijn> (and java)
roha has quit [Ping timeout: 260 seconds]
<mrvn> how does this work with type tags? When you hover the mouse over x, y where would it say "int * int"? The ","?
<pippijn> I find myself being a lot less consistent in ocaml
<pippijn> oh
<pippijn> I don't have that
<mrvn> pippijn: me neigther but I know some people do#
<mrvn> Sounds like a really nice feature
<pippijn> it does
tufisi has quit [Ping timeout: 240 seconds]
<mrvn> anyway, bed calls.
<pippijn> good night
gnuvince has quit [Ping timeout: 272 seconds]
avsm has quit [Quit: Leaving.]
tmaeda is now known as tmaedaZ