Keyword parameters 
Author Message
 Keyword parameters

Quote:
> Date: 2 Feb 92 02:33:00 GMT

> In my view, such named options should be syntactically distinguished
> from regular arguments.  Has this been done in a lisp-like language?
> Common Lisp keyword arguments lack the syntactic distinction and hence
> become a dynamic construct.  This allows such (in my opinion) abuses
> as having expressions whose values are keywords.  If an argument to a
> function might or might not be a keyword, compiled code always has to
> check for it.  This would seem to slow compiled code.

The reason keywords have to exist as objects is so that apply
can be used with them.  Things like

  (define (f g . args)
     ... (apply g args) ...)

should be possible, where args includes some keyword ones.



Tue, 26 Jul 1994 03:07:53 GMT  
 Keyword parameters

* > Date: 2 Feb 92 02:33:00 GMT

* > In my view, such named options should be syntactically distinguished
* > from regular arguments.  Has this been done in a lisp-like language?
* > Common Lisp keyword arguments lack the syntactic distinction and hence
* > become a dynamic construct.  This allows such (in my opinion) abuses
* > as having expressions whose values are keywords.  If an argument to a
* > function might or might not be a keyword, compiled code always has to
* > check for it.  This would seem to slow compiled code.

* The reason keywords have to exist as objects is so that apply
* can be used with them.  Things like

*   (define (f g . args)
        ... (apply g args) ...)

* should be possible, where args includes some keyword ones.

Perhaps, but I think Aubrey's point of separating the keyword passing
from the argument passing is a good one.  It does not have to be
syntactic, it can also be accomplished by using a higher-order
procedure:

((pretty-printer 'object 'port 'window-width)
 <some object> <some port> <some number>)

Then your code could be written as

(define (f g keywords . args)
  (apply (apply g keywords) args))

I realize that the style would be very different from CL, but I think
this is cleaner and allows for a simple and efficient implementation
of the common cases.



Wed, 27 Jul 1994 23:35:50 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Keyword parameters needed

2. Q: Symbol optional in keyword parameter definition?

3. Implementing keyword parameters

4. specialised keyword parameters

5. Semantics of parameter mode keywords (in,out,inout)

6. derived types with parameter keyword

7. extracting keywords from %(keyword)s-based templates

8. passing keyword arguments that are themselfs python keywords

9. Passing a parameter Rexx to JCL and return a parameter to JCL

10. VHDL to Verilog - parameter which is log2 of another parameter

11. Ada 0y wish list: parameters of package parameters

12. Parameter MyVar = ## Vs Parameter ( MyVar = ## )

 

 
Powered by phpBB® Forum Software