dylan changed the topic of #ocaml to: OCaml 3.09.1 available! Archive of Caml Weekly News: http://sardes.inrialpes.fr/~aschmitt/cwn/ | A free book: http://cristal.inria.fr/~remy/cours/appsem/ | Mailing List: http://caml.inria.fr/bin/wilma/caml-list/ | Cookbook: http://pleac.sourceforge.net/
ramkrsna has joined #ocaml
ski_ has joined #ocaml
ski has quit [Nick collision from services.]
ski_ is now known as ski
ski_ has joined #ocaml
ski has quit [Nick collision from services.]
ski_ is now known as ski
cookoo has joined #ocaml
khaladan has left #ocaml []
mrsolo_ has quit [Read error: 104 (Connection reset by peer)]
mrsolo_ has joined #ocaml
Submarine has quit ["Leaving"]
taw has joined #ocaml
<taw> hello
<taw> is there any way of getting extra typing information from the compiler ?
* taw trying to debug a typing error
<ski> zmdkrbou : how about tail-recursion-modulo-cons ?
nivrrex has joined #ocaml
nivrrex has left #ocaml []
<taw> am i not allowed to use a smaller variant function where a bigger one is expected ?
<flux__> taw, ocaml compiler can extract type information with -dtypes
<flux__> emacs' caml-mode makes use of it
<flux__> taw, btw, you don't need parenthesis in the let rec-definition
<taw> the shortest example
<taw> why isn't something of type a automatically of type b if a is a subset of b ?
<ski> different constructors with same name
<ski> try polymorphic variants
<taw> ski: they are polymorphic variants
<taw> note the `
<flux__> taw, not automatically, but there's :>
<ski> em, just saw that
<flux__> I think the limitation of not automating that is because of type inference..
<flux__> taw, compare ((`A:a):b) and ((`A:a):>b)
<flux__> (foo:bar) is a type annotation, :> is type coercion
<taw> oh
<taw> :>
<taw> why isn't it automatic ?
<taw> oh well, at least it works now
<flux__> I don't know, but I can imagine someone might be able to whip up an example where the automating would suck :)
<flux__> I would love that kind of automation with objects too..
<ski> # let f = function `A a -> a | `B a -> a;;
<ski> val f : [< `A of 'a | `B of 'a ] -> 'a = <fun>
<ski> you need '[< ...]' type
<ski> flux__ : no, that's for objects
<flux__> ski, but that ((`A:a):>b) works fine?
<ski> '[< ..blah..]' means "at least ..blah.."
<flux__> or what did you mean
<ski> flux__ : hm, it might actually be that ':>' could work here too, not sure
<ski> '[> ..blah..]' means "at most ..blah.."
<ski> # let g b a = if b then `A a else `B a;;
<ski> val g : bool -> 'a -> [> `A of 'a | `B of 'a ] = <fun>
<ski> (that's an example of the other one)
<ski> flux__ : yes, you're right, one can use ':>' to coerce polymorphic variants, too (had forgotten that)
<ski> taw : i'm not sure if one can type abbreviate a polymorphic variant type with an implicit constraint type variable without fixing it, though
<taw> ski: [< stmt] seems to do the right thing
foof has quit ["ERC Version 4.0 $Revision: 1.703 $ (IRC client for Emacs)"]
<ski> m
<ski> but you can't use '>' or '<' in a type abbreviation to a polymorphic variant type
<ski> (since it would contain a hidden type variable that can't be abstracted out)
ppsmimou has joined #ocaml
<ski> ppsmimou : but just applying CPS-transformation just shifts stack use into corresponding heap use, so you essentially just heap-allocate stack frames .. so no direct net win
<ppsmimou> yes of course, there's nothing magic here
<ppsmimou> you just avoid stack overflows
<ski> right
Revision17 has quit [Read error: 110 (Connection timed out)]
ppsmimou has quit [calvino.freenode.net irc.freenode.net]
ppsmimou has joined #ocaml
m3ga has joined #ocaml
dark_light has quit [Connection timed out]
vodka-goo has joined #ocaml
m3ga has quit ["disappearing into the sunset"]
dark_light has joined #ocaml
<dark_light> the ocamlc command produces arch-independant files?
<dark_light> "compiles Caml source files to bytecode object files".. ok, seems to be
<dark_light> but it just looks like a regular program o.o
<vodka-goo> it may include ocamlrun, which is arch independant
<vodka-goo> s/independant/dependant/
<vodka-goo> it is possible to have something independant, the generated file being a shebang executable calling ocamlrun
<vodka-goo> no, other way around
<vodka-goo> default is to produce a #!/usr/bin/ocamlrun executable, which is arch indep (you just need to have ocamlrun at the same place)
<vodka-goo> with -custom, ocamlrun (arch-dep) is included in the output executable, and bytecode is put at the end of the file in the data section
MisterC has quit [Remote closed the connection]
dark_light has quit [Remote closed the connection]
_fab has joined #ocaml
mikeX has joined #ocaml
mikeX has quit [Remote closed the connection]
mikeX has joined #ocaml
Smerdyakov has joined #ocaml
clog has joined #ocaml
mikeX_ has joined #ocaml
mikeX has quit [Connection timed out]
JosephRivers has joined #ocaml
<JosephRivers> Is there any way to have an enum-like type with normal constructors like One, Two, etc. but have the conversion to an integer incur no overhead?
stockholm_ has joined #ocaml
<stockholm_> Hello, I'm working on a game for one of my classes at school. For this game we need to implement a gui. I've written my game in OCaml and have never done any gui programming before. I was wondering if anyone had a minute or two to chat about design decisions, etc. of gui programming?
<mikeX_> stockholm_: just ask you questions, maybe someone will answer :)
<stockholm_> What do you use when you need to program a gui? Glade, GTK+, etc
<JosephRivers> I would suggest SDL. It's simple and there's ocaml bindings for it.
<stockholm_> For this project we need to be able to create a tiled map, such as in Warcraft. Users need to be able to drag and drop tiles onto this map. Is this something that is straightforward in SDL?
<JosephRivers> Well. Loki used to use SDL for all of their Linux game ports, so it should be quite suitable for the task.
<flux__> going the sdl way will mean you'll need to write your own user interface widgets, though
<flux__> or are there ready-made widgets for sdl?
<Demitar> Is this something in-game or an editor for the game?
<stockholm_> Something in game.
<flux__> sdl is a thin layer providing basically a frame buffer, while gtk provides actual user interface primitives
<Demitar> You probably want to go with an SDL or SDL + lablgl based solution, since you're creating a game. But as flux__ says, you'll have to roll your own widgets.
<Demitar> s/widgets/gui toolkit/
<stockholm_> Ok, well thank you all for your thoughts. I'm going to check into this SDL business.
<Demitar> You could of course build an FFI to an opengl gui library and use that. :)
<Demitar> s/an FFI/bindings/
* Demitar is getting sloppy, should get some rest. :)
<Demitar> stockholm_: Two important questions are of course how much experience you've had with ocaml and how much experience you've had at creating games. :)
<flux__> it's not impossible to embed real time updated bitmaps into a gtk application either
<flux__> but sdl will give you that stuff more easily
<flux__> atleast you'd need to think about different bit depths (and maybe use a library to handle that, like sdl does)
Unseen has joined #ocaml
<flux__> but, sleep (0010 here)
<stockholm_> I'd like to think I'm a decent OCaml programmer. I've had zero experience creating games (save for the last 10 weeks of my class). One other thing that I should note: I only have one week to learn and write this gui.
<Demitar> You could of course go with a gtk + opengl application but it won't "feel" like a usual game (unless you like Stars!). :)
<stockholm_> I've looked over some gtk+ stuff, but it seems like dragging and dropping pixmaps around is a little bit of a trouble.
<flux__> if all you need is drag'n drop from graphical elements, there is no need for complex gui libraries
<stockholm_> By complex gui libraries do you mean pre-built widgets and such?
* Demitar nods, if *all* you need is to drag and drop tiles you just need some picking (to use gl terms). :)
<pango> is looking at existing libs and projects in ocaml humps considered cheating ?
<pango> they're already games and game libs there
* Demitar is writing a game as we speak. :)
<stockholm_> No, it would not be cheating at all.
Unseen has quit [Remote closed the connection]
stockholm_ has quit ["Leaving"]
smimou has quit ["bli"]
vodka-goo has quit ["Connection reset by by pear"]
mrsolo_ has quit [Connection reset by peer]
mrsolo_ has joined #ocaml
_fab has quit []
mrsolo_ has quit [Read error: 104 (Connection reset by peer)]
mrsolo_ has joined #ocaml
mrsolo has quit [Read error: 104 (Connection reset by peer)]
cookoo has joined #ocaml