unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* keyword procedures?
@ 2002-06-22 19:54 Thomas Bushnell, BSG
  2002-06-24  1:43 ` Alex Shinn
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Bushnell, BSG @ 2002-06-22 19:54 UTC (permalink / raw)



The guile manual suggests that Guile has support keyword arguments,
but contains no information beyond a chapter heading.

But it looks like it's in ice-9/optarg.scm.  So some questions:

  *Exactly* when are default expressions evaluated, and with what
  bindings already made?

  I need to generate keywords programmatically.  What is the analog of
  string->symbol for keywords, and can you give an example of its use?

  Is lambda* more widely implemented than just in Guile?

Thomas


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: keyword procedures?
  2002-06-22 19:54 keyword procedures? Thomas Bushnell, BSG
@ 2002-06-24  1:43 ` Alex Shinn
  0 siblings, 0 replies; 2+ messages in thread
From: Alex Shinn @ 2002-06-24  1:43 UTC (permalink / raw)
  Cc: guile-user

>>>>> "Thomas" == Thomas Bushnell, BSG <tb@becket.net> 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

_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-06-24  1:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-06-22 19:54 keyword procedures? Thomas Bushnell, BSG
2002-06-24  1:43 ` Alex Shinn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).