From: "Daniel Bünzli" <daniel.buenzli@epfl.ch>
To: caml-list@yquem.inria.fr
Subject: lablgl (was Re: [Caml-list] Stdlib)
Date: Tue, 1 Nov 2005 16:30:51 +0100 [thread overview]
Message-ID: <B99CF8B8-F656-4E49-927F-4D9B6F3BD2CE@epfl.ch> (raw)
In-Reply-To: <1130803637.488.28.camel@starlight>
Le 1 nov. 05 à 01:07, Jonathan Bryant a écrit :
> On another note, I would love to do this other project in OCaml,
> but it
> is OpenGL intensive (read: based) and LablGL drives me nuts. The
> named
> argument thing drives me up the wall because it's more information
> that
> I don't want to have to learn and internalize.
Besides the fact that labels can be omitted, I think this is an
unfair criticism and that it is actually better to write the labels.
Opengl C functions can have up to 11 argument (e.g. glTexSubImage3D,
not bound in lablgl), if you use this function you will have, labels
or not, to look up its documentation. You can see the advantage of
labels once you are reading your code looking for a bug. If you don't
write the labels you will have to read again the documentation to
check that you passed everything at the right place, with labels you
needn't.
These bindings are very carefully done (the "meta-programmation" of
glue code is worth having a look if you once have to do bindings) and
the interface is quite elegant. The only critique I have about the
library is that it doesn't define everything in a single module Gl
but scatters functions in different modules whose prefix doesn't
necessarily match the prefix of the C function name. For example :
- glLoadMatrix is GlMat.load
- glLogicOp is GlFunc.logic_op
- glPixelStore is GlPix.store.
etc.
This non-obvious name mapping makes it harder to learn the api and to
port C OpenGL code samples. I don't understand this design decision,
especially because, in the end, the documentation you need to consult
is the C api documentation and therefore there should be an obvious
mapping between C and ocaml names. Defining a single module Gl so
that a C function name glDipDap is trivially mapped to Gl.dip_dap
would be much more productive for the programmer.
Daniel
next prev parent reply other threads:[~2005-11-01 15:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-01 0:07 Stdlib Jonathan Bryant
2005-11-01 6:08 ` [Caml-list] Stdlib Jacques Garrigue
2005-11-01 13:54 ` Jon Harrop
2005-11-01 15:30 ` Daniel Bünzli [this message]
2005-11-01 15:45 ` lablgl (was Re: [Caml-list] Stdlib) Jonathan Bryant
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=B99CF8B8-F656-4E49-927F-4D9B6F3BD2CE@epfl.ch \
--to=daniel.buenzli@epfl.ch \
--cc=caml-list@yquem.inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).