This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: new snarf macro: SCM_VAR
- To: Keisuke Nishida <kxn30 at po dot cwru dot edu>
- Subject: Re: new snarf macro: SCM_VAR
- From: Dirk Herrmann <dirk at ida dot ing dot tu-bs dot de>
- Date: Fri, 5 May 2000 10:58:34 +0200 (MEST)
- cc: guile at sourceware dot cygnus dot com
On 4 May 2000, Keisuke Nishida wrote:
> Defining SCM_VAR is pretty easy and generally useful, I think.
> So, how about defining the following macros in Guile's snarf.h?
>
> #define SCM_VAR(NAME, CODE) \
> SCM_HERE (static SCM NAME) \
> SCM_INIT (NAME = CODE)
>
> #define SCM_GLOBAL_VAR(NAME, CODE) \
> SCM_HERE (SCM NAME) \
> SCM_INIT (NAME = CODE)
I think adding such a macro would be a good idea. You would have to
protect the variable contents from gc, though.
However, I do have some problems with the current naming of all these
snarfing macros:
* I'd prefer a common prefix like SCM_DECLARE_, for example
SCM_DECLARE_FUNCTION or something.
* To me it is strange that a declaration SCM_SYMBOL will generate a static
definition, while SCM_GLOBAL_SYMBOL will provide a non-static one. I'd
prefer SCM_DECLARE_STATIC_... for static definitions, because that's the
way a C programmer thinks.
Do others feel the same way?
Best regards
Dirk Herrmann