guile-devel
[Top][All Lists]
Advanced

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

Re: unknown location: definition in expression context in subform optnam


From: Mark H Weaver
Subject: Re: unknown location: definition in expression context in subform optname-from of "_^"
Date: Sun, 29 Jan 2012 16:32:28 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux)

Andy Wingo <address@hidden> writes:
> Keyword arguments suit this task much better.

Okay, I have a fresh idea for your consideration.

Let's provide a more general facility to make keyword arguments more
convenient to use from C, while avoiding repeatedly interning them.  I
propose a new macro SCM_KEYWORD, which would be defined something like
this:

#ifdef __GNUC__
# define SCM_KEYWORD(name)                       \
  ({ static SCM keyword = SCM_BOOL_F;            \
     if (SCM_UNLIKELY (scm_is_false (keyword)))  \
       keyword = scm_from_utf8_keyword (#name);  \
     return keyword; })
#else
# define SCM_KEYWORD(name) scm_from_utf8_keyword (#name)
#endif

Furthermore, at some point in the future we could provide an optional
alternative mechanism, where SCM_KEYWORD would expand into a simple
global variable reference, and we'd provide a snarfing script to scan
the sources for SCM_KEYWORD and produce an initialization routine for
all these global keywords.

It might be good to do something similar for looking up and caching
scheme procedures as well.

What do you think?

    Mark



reply via email to

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