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

Re: Alternative formulations of keywords

This page is part of the web mail archives of SRFI 89 from before July 7th, 2015. The new archives for SRFI 89 contain all messages, not just those from before July 7th, 2015.

John Cowan wrote:
Marc Feeley scripsit:
Are you saying that the programmer writes

     (foo 'bar foo: 32 bar: 54)

and the compiler transforms this to

     (foo 'bar (list (cons 'foo: 32) (cons 'bar: 54)))

No, to a literal, not a run-time constructor.

What if you replace 32 and 54 by non-literal expressions?

... A general implementation of SRFI 89 must parse the list of parameters at run time because some of the keywords may be computed.

What are the use cases for computed keywords?

As long as one can handle computed keywords using (apply ...) or some
similar higher-order function, then I really don't care about computed
keyword support in the "sugared syntax".

Note also that if we define [as I suggested in my previous message]
  keyword: value  ;; or whatever alternative syntax is chosen
as syntactic sugar for:
  (make-association 'keyword value)
then handling computed keywords is easy by writing an explicit
make-association call.
	--Per Bothner
per@bothner.com   http://per.bothner.com/