[Top][All Lists]

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

Re: make-module question.

From: Andy Wingo
Subject: Re: make-module question.
Date: Mon, 06 Sep 2010 13:25:06 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)


On Sat 04 Sep 2010 23:10, Ian Hulin <address@hidden> writes:

> If #:key is a superset of #:optional

#:key is not a superset of optional. Keyword parameters are bound by
name; optional parameters are bound by position. Keyword parameters are
not bound by position.

  ((lambda* (#:optional foo) foo) 10) => 10
  ((lambda* (#:key foo) foo) 10) => Error.

> If this is the case, could I request an enhancement for this the base
> code to declared using
> (define* (make-module #:key (size 31) (uses '()) (binder #f))
>    ...)

Unfortunately we cannot, as this would be an incompatible change.

> If make-module is declared using #;key, how would this affect calling it
> from code with scm_call_1, scm_call_2, scm_call_3 or scm_call_n?

> SCM keyname = scm_str2symbol ("#;uses");

In modern Guile (>= 1.8), one makes a symbol from a string via
scm_from_locale_symbol. However in this case you want to make a keyword,
so use scm_from_locale_keyword ("uses").

(Actually, we should be using scm_from_latin1_keyword here, but that
doesn't exist yet.)

> SCM modlist = scm_list_2 (scm_str2sym("ice-9 syncase"),
>  scm_str2sym("ice-9 debug"))

Neither of these modules are needed in current Guile. scm_str2sym is not
a part of Guile either; assuming it is one of your functions, you should
use your own namespace (ly_ for example), not Guile's (scm_).

> scm_call_2( SCM_VARIABLE_REF (scm_make_module_x), keyname, modlist):

Yes, you would call it like this.



reply via email to

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