On 13 Oct 2009, at 10:24 pm, John Cowan wrote:
> Alaric Snell-Pym scripsit:
>
>> 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.
>
> It imports the same set of names in either case, whether it's using
> real OpenGL code or its own fake code, which presumably are stored in
> different code files.
Yes; but that's not what I'm asking about.
AIUI, you said that cond-expand could only detect what modules had
been imported, not what modules are *available*:
> Module names, like feature groups, are recognized by cond-expand (from
> SRFI 0), which makes it possible to conditionally control the actions
> of a program depending on what modules have been imported into it.
^^^^^^^^^^^^^
Writing my code that can take advantage of an opengl module if it's
available, how do I decide whether to import it or not? I can't put my
import in a cond-expand for opengl, as it'll always fail - as opengl
is not imported at that point.
We need a way to check if a module is *available* so we can try and
import it, not just whether it's been imported!
ABS
--
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