On Dec 1, 5:37 pm, mehrheit <[EMAIL PROTECTED]> wrote: > On Mon, 1 Dec 2008 06:53:47 -0800 (PST) > > ivant <[EMAIL PROTECTED]> wrote: > > > On Dec 1, 9:23 am, "Andrew P. Lentvorski, Jr." <[EMAIL PROTECTED]> > > wrote: > > > (defmacro with-gl > > [gl mode & body] > > `(try (. ~gl glBegin (. GL ~mode)) > > [EMAIL PROTECTED] > > (finally (. ~gl glEnd)))) > > > I think it is better, because it uses try/finally to make sure the > > gl.glEnd is always called; and the macro name uses the with-* > > convention, like with-open, with-meta, etc. > > I think it would be better to call it with-gl-begin or with-gl-block, > since with-gl sounds more general, and this macro specifically creates > a begin/end block.
I don't know much about OpenGL so whatever makes more sense here is fine. I just think, that "with-gl-begin" sounds like a begin without end, so I would consider an alternative... > > Also, `gl' would be evaluated twice, therefore it should be let onto a > gensym, like `(let [gl# ~gl] ...)'. This may not be very important in > this macro, since gl would probably be a variable reference, but > generally it's an important guideline. You are generally right about this, but not in this case. This macro *explicitly* captures the variable "gl". It is actually used in the body and is expected to be bound to the result of glBegin. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---