On 13 Oct 2009, at 5:22 pm, John Cowan wrote: > Alaric Snell-Pym scripsit: > >>> No. The idea is this: >>> >>> (module open-gl >>> (export ...) >>> (cond-expand >>> (has-open-gl (include "open-gl-glue.scm")) >>> (else (include "open-gl-emulator.scm")))) >> >> Ah, but where in this appears your import of the OpenGL library, if >> it's available? :-) > > The actual library is written in C, and I assume we don't import C > source into Scheme. The "open-gl-glue.scm" would be Scheme code > that uses the FFI to talk to OpenGL itself.
Ah, you're writing the OpenGL library, rather than a library that uses it if it's available or does its own rendering if not, which is what I meant. I mean: say you're writing a 3D graph drawing lib that would like to use opengl where available, or software rendering where not. How does it conditionally import the opengl module? Eg, attempt to import it, and not fail if it's not there? Once it's past that hurdle, cond- expand should be sufficient to select between opengl and software rendering. Anyway, if you're *defining* the OpenGL library, then who exactly is specifying "has-open-gl"? But that's another issue... -- Alaric Snell-Pym Work: http://www.snell-systems.co.uk/ Play: http://www.snell-pym.org.uk/alaric/ Blog: http://www.snell-pym.org.uk/archives/author/alaric/ _______________________________________________ r6rs-discuss mailing list [email protected] http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss
