[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: keyword procedures?
From: |
Alex Shinn |
Subject: |
Re: keyword procedures? |
Date: |
Mon, 24 Jun 2002 10:43:05 +0900 |
User-agent: |
Wanderlust/2.8.1 (Something) Emacs/21.2 Mule/5.0 (SAKAKI) |
>>>>> "Thomas" == Thomas Bushnell, BSG <address@hidden> writes:
Thomas> The guile manual suggests that Guile has support keyword
Thomas> arguments, but contains no information beyond a chapter
Thomas> heading.
Thomas> But it looks like it's in ice-9/optarg.scm. So some
Thomas> questions:
Thomas> *Exactly* when are default expressions evaluated, and with
Thomas> what bindings already made?
Looks like lambda* expands into let-optional* => let-keywords* => let*
where each keyword is bound in the order it's defined and the defaults
are not evaluated unless the keyword is not given. You can play with
macroexpanding the examples in the source.
Thomas> I need to generate keywords programmatically. What is the
Thomas> analog of string->symbol for keywords, and can you give an
Thomas> example of its use?
Been playing with this myself recently for a home-brew object system:
guile> (apropos "keyword")
(guile): symbol->keyword #<procedure symbol->keyword (symbol)>
(guile): keyword->symbol #<procedure keyword->symbol (kw)>
(guile): keyword-like-symbol->keyword #<procedure
keyword-like-symbol->keyword (sym)>
(guile): make-keyword-from-dash-symbol #<primitive-procedure
make-keyword-from-dash-symbol>
(guile): keyword? #<primitive-procedure keyword?>
(guile): keyword-dash-symbol #<primitive-procedure keyword-dash-symbol>
Thomas> Is lambda* more widely implemented than just in Guile?
I've never seen it elsewhere... the keyword handling looks more
portable, as bigloo, kawa and gauche all support keywords.
--
Alex