guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Guile C preprocessor


From: Keisuke Nishida
Subject: Re: Guile C preprocessor
Date: 12 Dec 2000 03:14:58 -0500
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.0.92

Neil Jerram <address@hidden> writes:

> Hmmm...  It looks interesting.  The main advantages seem to be (i)
> automatic generation of argument validation code (ii) possible future
> argument type reflection (iii) possible future replacement of argument
> validation by something like Mikael's Ior.

Right.  I think type declaration is one progress toward the future.

> - How does it work with emacs tags?  (Although, perhaps SCM_DEFINE
>   already doesn't.)

SCM_DEFINE does.  From libguile/Makefile.am:

ETAGS_ARGS = 
--regex='/SCM_\(GLOBAL_\)?\(G?PROC\|G?PROC1\|SYMBOL\|VCELL\|CONST_LONG\).*\"\([^\"]\)*\"/\3/'
 \
   --regex='/[ \t]*SCM_[G]?DEFINE1?[ \t]*(\([^,]*\),[^,]*/\1/'

This does not work with my previous syntax, though.  Probably I should
do as follows:

SCM_DEFINE_PROCEDURE (scm_foo, "foo")
    (scm_string_class bar, scm_integer_class baz)
"This is foo."
{
  ...
}

> - Is it extensible, so I can use it to write, say, guile-xlib.  For
>   this I'd need to be able to declare new argument types for
>   validation.

We could define new types by creating new smobs/classes

SCM_DEFINE_SMOB (scm_new_type, ...);
SCM_DEFINE_CLASS (scm_new_class, ...);

or we could define special types like this:

SCM_DEFINE_TYPE (scm_my_type, x, SCM_STRINGP (x) || SCM_INUMP (x));

> - What happens to the docstring?

Probably we should produce several files (*.c, *.h, *.doc) from a single
source (say, *.gc).  I think this is easier to maintain.

> - What language is the preprocessor written in?  It would be nice if
>   it was Guile, but I guess we can't rely on Guile being available
>   when building Guile.

We can distribute preprocessed files if we want.  But probably this is
not a problem because most people just use binary packages.

-- Kei



reply via email to

[Prev in Thread] Current Thread [Next in Thread]