This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: message primitive
thi <ttn@mingle.glug.org> writes:
> Greg J. Badros writes:
>
> > Because we need to be able to use it from the C level (for error
> > handling). I find it a bit ugly to use Scheme code from within the
> > core.
>
> perhaps the C procedure could be changed to use ~A and ~S, and then all
> callers in libguile could be updated. then we have consistency from the
> C world and the scheme world. because this procdure was not advertized
> in the first place (hence this discussion), it is reasonable to make
> this kind of change before exposing it.
That's what I've done. See the NEWS entry on it from CVS guile
(included below for your convenience)
Greg
* New primitive: `simple-format', affects `scm-error',
scm_display_error, & scm_error message strings
(ice-9 boot) makes `format' an alias for `simple-format' until possibly
extended by the more sophisticated version in (ice-9 format)
(simple-format port message . args)
Write MESSAGE to DESTINATION, defaulting to `current-output-port'.
MESSAGE can contain ~A (was %s) and ~S (was %S) escapes. When printed,
the escapes are replaced with corresponding members of ARGS:
~A formats using `display' and ~S formats using `write'.
If DESTINATION is #t, then use the `current-output-port',
if DESTINATION is #f, then return a string containing the formatted text.
Does not add a trailing newline."
The two C procedures: scm_display_error and scm_error, as well as the
primitive `scm-error', now use scm_format to do their work. This means
that the message strings of all code must be updated to use ~A where %s
was used before, and ~S where %S was used before.