Hi, Kevin Ryde <[EMAIL PROTECTED]> writes:
> Perhaps cond-expand could be extended. Maybe `guile-foo' feature to > mean one of guile's features list. I'd be tempted to think that having a different construct is clearer. Especially since it makes it unnecessary to add a magic `guile-' prefix to feature names. >> (if (provided? 'stuff) >> (do-stuff) > > That should be ok though. A good compiler will want to recognise and > optimize things like that, and drop resulting dead code. Performing this kind of optimization somehow breaks the compilation/execution boundary (see the links Rob posted): `provide?' is just a regular procedure, and as such its invocations should not be evaluated at compilation-time (the same goes for `defined?'). Besides, using `provided?' this way can yield "unbound variable" errors, depending on how the run-time system is implemented. Suppose for instance that `do-stuff' is bound only when feature `stuff' is provided: a not-so-smart compiler/interpreter could try to lookup symbol `do-stuff', even if `stuff' is not provided. > (Gratuitous plug: in my guile-lint I look for a few forms like that, > to suppress warnings in code that's intended for particular guile or > module versions.) That looks nice! Why not make it a GNU project or at least advertise it on the Guile web page or manual? Thanks, Ludovic. _______________________________________________ Guile-devel mailing list [email protected] http://lists.gnu.org/mailman/listinfo/guile-devel
