Hi, On Thu 30 Jun 2011 23:37, l...@gnu.org (Ludovic Courtès) writes:
> Andy Wingo <wi...@pobox.com> skribis: > >> After some thinking, the base thing to do is just to add a warning port, >> and make warnings (non-fatal informative messages) write to that port. >> I have done this in the attached patches. Any objections? > > Ideally I’d preferred to keep current-warning-port in (system base > message), but since it’s needed in boot-9, we may have to make it > global. Or would the following work? Yeah I tried to do that, but since it's needed in C (potentially quite early, even before modules) and in Scheme I just bit the bullet and added it to the default env. > (define-module (guile-user) > #:autoload (system base compile) (compile compile-file) > + #:autoload (system base message) (%current-warning-port) > #:filename #f) Wouldn't work, because it's needed in (guile), not (guile-user). > Besides, it would be great if ‘*current-warning-prefix*’ were handled > consistently, too. All this could certainly be factorized in a Scheme/C > function that takes care of using the right port and prefix. It would, but then you're talking about standardizing a `warning' function, and that's problematic, as some warnings will have source locations and others will not, and we already have `warn' in the base env which has a rest arg so it's not extensible with keywords, etc etc, and system base message is really about compiler warnings (requiring source location) and not all warnings, so it's a bit of a mess. (And that's not to mention more general logging facilities, with levels and categories and such.) Note that it is also possible to prefix all output with soft ports. Basically I appreciate the concerns but have not found a way to solve the whole problem nicely, so I kept it simple. As it seems we agree on the need for higher-level solutions based on a warning port accessible in (guile) and C, I'm going to see about committing something along these lines, and we can work on higher-level warning facilities later. Regards, Andy -- http://wingolog.org/