<mrvn>
Args, Obj.field starts at 0. The block is size 1 so Obj.field t 1 reads beyond the block.
<mrvn>
Drakken: The type id of a Constructor with arguments is encoded in the tag field of the block
<Drakken>
what's a block?
<Drakken>
is that just an array of bites that represent the value?
<Drakken>
or words. not bytes.
<mrvn>
Drakken: A block is a chunk of memory. It starts with one value that contains a tag, the length of the block and some internal bits for the GC followed by n values of contents.
<mrvn>
Anything that isn't a simple type like int, char, unit etc is stored as block
bzzbzz has quit [Quit: leaving]
<Drakken>
oh. I thought there was usually a pointer to the data. maybe I'm thinking of Lisp.
<mrvn>
Drakken: the pointer always points to a block
<Drakken>
but an array of floats isn't actually a C array of blocks, is it? It's an array of pointers?
err404 has quit [Remote host closed the connection]
<mrvn>
Drakken: Normaly it should be an array of values, each value being a pointer to a block with tag 'double_tag' and containing a double. But ocaml optimizes that into a single block containing only doubles.
<Drakken>
right.
Cyanure has quit [Remote host closed the connection]
benozol has quit [Ping timeout: 252 seconds]
KDr2 has joined #ocaml
<xenocons>
mrvn: cool
<xenocons>
hrmm
<xenocons>
is it easy to get the ocaml IL into the repl?
<mrvn>
il?
<xenocons>
like bytecode
<xenocons>
well actually i dont know how the repl of ocaml really works, i guess assembly would be cool
<xenocons>
lisp/scheme have disassemble/decompile in the repl
<mrvn>
ocaml doesn't optimize so it should be quite easy to decompile.
<xenocons>
and it doesn't encourage tinkering as much on a per function basis =P
<mrvn>
the native compiler isn't in the toplevel eigther so no loss.
<xenocons>
ah
<pippijn>
what about a bytecode disassemblyß
<xenocons>
itd be cool to have a verbosity flag
<xenocons>
disassemble asm foo
<xenocons>
disassemble il foo
<xenocons>
i think i can do the IL easily in F# stuff
<xenocons>
duno about ocaml or how accessible it is
<xenocons>
(from the top level)
<mrvn>
you can probably write one quite easily. The interpreter can already interpret the code. All you have to do is print the code instead of executing it.
<xenocons>
mm makes sense
<xenocons>
so is ocamls toplevel using a bytecode?
<mrvn>
yes.
<xenocons>
is there only one bytecode compiler ? heh
<xenocons>
heh, from what little i know about them
<pippijn>
interesting
<xenocons>
i think ocaml vs F# are going in different directions here
<xenocons>
probably because how ocaml lets you have higher order modules or whatever, but i doubt that would be possible in F# because of .net *starts rambling*
<mrvn>
being costly isn't a side effect. Aborting the function is.
<xenocons>
aborting a function is costly i guess?
<mrvn>
being costly isn't a side effect
<xenocons>
ok
skchrko has quit [Ping timeout: 240 seconds]
skchrko has joined #ocaml
skchrko has quit [Remote host closed the connection]
jimmyrcom has joined #ocaml
cyphase has quit [Ping timeout: 245 seconds]
wicko has joined #ocaml
Znudzon has joined #ocaml
<wicko>
Hi. I'm using lablgtk to make a little drawing program. I want to draw an image, saved in myfile.png, onto my backing pixmap. What's the best way to do that? Thanks.
<zorun>
wicko: isn't there a documentation? I guess adrien could help, though
rby has quit [Ping timeout: 252 seconds]
<wicko>
What I'm trying at the moment is converting my file to xpm, then generating a pixmap from that using Pixmap.create_from_xpm, and then putting that pixmap onto my drawing area. But the create_from_xpm call throws an error complaining that the assertion `drawable != NULL || colormap != NULL' failed.
rby has joined #ocaml
Cyanure has joined #ocaml
oriba has joined #ocaml
<_andre>
does anyone from the debian ocaml team hang around here?
<mrvn>
_andre: better go to #debian-ocaml@irc.debian.org
rby has quit [Ping timeout: 252 seconds]
<_andre>
mrvn: thanks
rby has joined #ocaml
Tobu has quit [Ping timeout: 272 seconds]
wicko has left #ocaml []
Tobu has joined #ocaml
iago has joined #ocaml
cago has quit [Quit: Leaving.]
rby has quit [Read error: Connection reset by peer]
milosn has quit [Read error: Connection reset by peer]
<adrien>
otoh, if you were in C, you'd be doing [ return "a"; ] in the code of the function you're calling
<adrien>
no free lunch :-)
Cyanure has quit [Ping timeout: 260 seconds]
seanmcl has joined #ocaml
Tobu has quit [Ping timeout: 272 seconds]
ftrvxmtrx has quit [Quit: Leaving]
skchrko has joined #ocaml
<_habnabit>
adrien, unless you write it in python
<adrien>
but it's not free for the performance eitehr
<_habnabit>
python has some pretty dang good performance
<_habnabit>
especially when you translate it to C
skchrko has quit [Quit: ChatZilla 0.9.88.1 [Firefox 11.0/20120314111819]]
avsm has joined #ocaml
<Drakken>
The ocamlbuild pp tag takes a command as argument. Is there a way to specify a custom tag like that in a myocambuild.ml dep command?
Tobu has joined #ocaml
<Drakken>
Repeating the problem I posted earlier:
<Drakken>
I added the tag pp("camlp4 foo.cmo"), but ocamlbuild said it couldn't find the command "camlp4 foo.cmo"
<Drakken>
Then I built foo.cmo manually, but ocamlbuild complained about "leftover compiled files".
<Drakken>
But I'm not sure how to specify a custom tag in the dep statement.
benozol has quit [Quit: Konversation terminated!]
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
iago has joined #ocaml
lorill has joined #ocaml
ulfdoz has joined #ocaml
iago has quit [Quit: Leaving]
sepp2k has joined #ocaml
djcoin has quit [Quit: WeeChat 0.3.2]
avsm has quit [Quit: Leaving.]
Tobu has quit [Ping timeout: 272 seconds]
wicko has joined #ocaml
Tobu has joined #ocaml
Xizor has joined #ocaml
<wicko>
Hello. What's the best way to catch key_press events (specifically the 'enter' key) on a GEdit.entry object? There doesn't seem to be a #connect#key_press method for this kind of object.
Xizor has quit [Client Quit]
lorill has quit [Quit: Ex-Chat]
wicko has quit [Ping timeout: 245 seconds]
ftrvxmtrx has joined #ocaml
twittard has quit [Quit: twittard]
seanmcl has quit [Quit: seanmcl]
alpounet has quit [Quit: Bye.]
<adrien>
damn
<adrien>
for wicko, there is a #connect#validated or something like that method
alpounet has joined #ocaml
pangoafk is now known as pango
albacker has joined #ocaml
albacker has quit [Changing host]
albacker has joined #ocaml
twittard has joined #ocaml
<pippijn>
what's people's opinion on literate programming?
cyphase has joined #ocaml
<jonafan>
i have always viewed comments as line noise
blue_prawn has joined #ocaml
<blue_prawn>
gildor: Hi, is it possible and how to not install the ocamldoc generated doc with setup.ml -install ?
<blue_prawn>
or maybe someone else can answer too ?
<lorill>
especially on my loading of images & sounds, I don't really like what I've done
<mrvn>
grrr, I need type ('a * 'b) t = 'a 'b
<adrien>
lorill: obviously, first thing: building it; what is the source of your ocaml distribution?
<lorill>
not sure if I understood the question. I'm using ocaml on debian
<lorill>
but this should work everywhere, provided sdl is installed
<adrien>
iirc that won't work on my godi installation ;-)
<lorill>
but yeah, between godi, oasis, omakefiles & ocamlbuild, i'm a little lost
<mrvn>
Error: Unbound module Sdlmixer, and I don't have an SDL for ocaml 4.0 :(
<_habnabit>
mrvn, what would that type mean
<lorill>
so I use ocamlbuild since it also works well with ocaide
<lorill>
but even if it compiled, that's a nice game for my 4 year old, but probably too easy for any adult :)
Cyanure has quit [Remote host closed the connection]
<mrvn>
_habnabit: I need two lists: ('a key, 'a data) list and ('a key, 'a ptr) list where 'a is existential ia GADTs.
<mrvn>
And I don't want to duplicate the code or use functors or something for the lists
<blue_prawn>
lorill: my first comment on the code: your lines length is too long
<adrien>
lorill: that is more portable provided ocamlfind support is available: ocamlbuild -I maze -use-ocamlfind -pkgs bigarray,sdl,sdl.sdlttf,sdl.sdlmixer sdlmaze.native
<mrvn>
_habnabit: or in other words I want a (key, data) list that contains pairs of 'a key * 'a data
<adrien>
(it's missing sdl loader right now)
<adrien>
(and I'll kill people who avoid ocamlfind myself if needed =) )
<blue_prawn>
lorill: most often it is recommanded 80 char max, 127 is far too long 'cause my term is only until 125
<adrien>
the META I have through godi for sdl seems to be missing sdl loader =/
<lorill>
yeah, I'm a bit lax on this, with widescreens, but this is noted. 80 seems hard to follow, though
<blue_prawn>
lorill: if 80 is too short for you maybe you could limit to 90 or 100 max
<blue_prawn>
lorill: if you are on linux you can check this with the command wc -L *.ml
<lorill>
is ocamlfind part of the standard distribution ?
<lorill>
blue_prawn: actually, my editor shows a bar at 80, so I can do this quickly
<lorill>
i have no excuse
<lorill>
ok, line length is fixed. I can't find ocamlfind on my system though
<blue_prawn>
lorill: shouldn't the None case in the blit function raise an exception or print a warning ?
<blue_prawn>
for what I understand this case should not happen
<lorill>
yes, that's a part why I'm unhappy
<lorill>
I don't know wether to keep this, instantiate a simple object, use a hashmap, or whatever
<lorill>
with a hashmap i'll have to use strings, so a typo & runtime error becomes possible
<blue_prawn>
I guess you're not happy with refs for your data, but I don't think it's really a problem
<lorill>
more with the option actually
<adrien>
lorill: ocamlfind is not part of the standard distribution; however, it's close to impossible to do actual ocaml development without it
<lorill>
but I can't load them before calling sdl init
<lorill>
adrien: i found the package
<lorill>
but no sdlloader, as you found out before
<blue_prawn>
lorill: yes and it is for the same reason that the std Arg module uses refs, it's not a real problem, problem is if a ref is a global variable really used and modified
<adrien>
yeah, it's easy to hand-edit however
<lorill>
does anyone still uses OCamlMakefile, or is this old legacy ?
<adrien>
just copy paste any "subpackage" in the file named "META" which is for sdl
<adrien>
and I'm adding "push fix for ocaml-sdl's META" to my TODO
<lorill>
where are this meta files ?
<lorill>
yeah, mine aren't global, but still nullable
<lorill>
and i'd like if they weren't
<lorill>
(ok, found the meta)
<adrien>
ah, hmm
<adrien>
I don't know if apt/dpkg is going to like that you change the file however
<lorill>
can I make a local copy in the project or something ?
<adrien>
I don't think so
<adrien>
but currently, if I were you, I'd add the line I gave to build.sh but as a comment
<lorill>
that's what i did
<adrien>
and quickly explain why/when it can be useful
<lorill>
but i don't use this script actually, ocaide does the build for me
<adrien>
(I'm going to push that bug report right now)
<adrien>
and as for OCamlMakefile, it's still actively maintained
<adrien>
and it's not working bad
<blue_prawn>
lorill: swap array i (Random.int (i+1)) shouldn't it be swap array i (Random.int i) ?
<blue_prawn>
lorill: because Random.int n gives something from 0 inclusive and n exclusive
<blue_prawn>
lorill: (in the shuffle function in generator.ml)
<lorill>
the shuffle function was a copypasta actually
<lorill>
i'm rereading it right now
<lorill>
my guess would be that the original want to allow the item to stay in place
<lorill>
but yeah, that's some ugly code to shuffle 4 directions
<lorill>
let shuffle lst = List.sort (fun a b -> (Random.int 3) - 1) lst
<lorill>
that's clearer and good enough for my use
ftrvxmtrx_ has joined #ocaml
<jonafan>
why use the O(n) you have when you can use O(n log n) that doesn't work as well
ftrvxmtrx has quit [Ping timeout: 248 seconds]
<blue_prawn>
when you have copy-past from there you have made a change, the original does a for downto, while the Array.iter does from 0 until the last one, so it is not equivalent
<lorill>
yeah, i remembered the hostname, but that wasn't that actually :(