Email list hosting service & mailing list manager

Reviewing named and optional parameters Daphne Preston-Kendal (07 Jun 2021 15:45 UTC)
Re: Reviewing named and optional parameters Marc Nieper-Wißkirchen (07 Jun 2021 16:07 UTC)
Re: Reviewing named and optional parameters Daphne Preston-Kendal (09 Jun 2021 08:50 UTC)
Re: Reviewing named and optional parameters Marc Nieper-Wißkirchen (09 Jun 2021 09:13 UTC)
Re: Reviewing named and optional parameters Daphne Preston-Kendal (09 Jun 2021 09:42 UTC)
Re: Reviewing named and optional parameters Marc Feeley (09 Jun 2021 10:24 UTC)
Re: Reviewing named and optional parameters Marc Nieper-Wißkirchen (09 Jun 2021 10:32 UTC)
Re: Reviewing named and optional parameters Marc Feeley (09 Jun 2021 12:16 UTC)
Re: Reviewing named and optional parameters Marc Nieper-Wißkirchen (09 Jun 2021 12:41 UTC)
Re: Reviewing named and optional parameters Marc Feeley (09 Jun 2021 13:10 UTC)
Re: Reviewing named and optional parameters Marc Nieper-Wißkirchen (09 Jun 2021 15:56 UTC)
Re: Reviewing named and optional parameters Marc Feeley (09 Jun 2021 18:15 UTC)
Re: Reviewing named and optional parameters Marc Nieper-Wißkirchen (09 Jun 2021 10:27 UTC)
Re: Reviewing named and optional parameters Daphne Preston-Kendal (14 Oct 2021 10:42 UTC)
Re: Reviewing named and optional parameters John Cowan (09 Jun 2021 17:22 UTC)
Re: Reviewing named and optional parameters Marc Nieper-Wißkirchen (09 Jun 2021 17:38 UTC)
Re: Reviewing named and optional parameters Peter Bex (08 Jun 2021 05:18 UTC)
Re: Reviewing named and optional parameters Per Bothner (08 Jun 2021 05:38 UTC)
Re: Reviewing named and optional parameters Daphne Preston-Kendal (09 Jun 2021 09:01 UTC)
Re: Reviewing named and optional parameters Per Bothner (10 Jun 2021 17:23 UTC)
Re: Reviewing named and optional parameters Daphne Preston-Kendal (21 Jun 2021 07:23 UTC)
Re: Reviewing named and optional parameters Daphne Preston-Kendal (09 Jun 2021 08:55 UTC)
Re: Reviewing named and optional parameters John Cowan (09 Jun 2021 14:30 UTC)
Re: Reviewing named and optional parameters Marc Nieper-Wißkirchen (09 Jun 2021 14:44 UTC)
Re: Reviewing named and optional parameters John Cowan (09 Jun 2021 17:03 UTC)
Re: Reviewing named and optional parameters Marc Nieper-Wißkirchen (09 Jun 2021 17:33 UTC)
Re: Reviewing named and optional parameters John Cowan (09 Jun 2021 17:37 UTC)
Re: Reviewing named and optional parameters Marc Nieper-Wißkirchen (09 Jun 2021 17:40 UTC)
Re: Reviewing named and optional parameters John Cowan (09 Jun 2021 19:01 UTC)
Re: Reviewing named and optional parameters Marc Nieper-Wißkirchen (09 Jun 2021 19:26 UTC)
Re: Reviewing named and optional parameters Daphne Preston-Kendal (10 Jun 2021 10:17 UTC)
Re: Reviewing named and optional parameters Marc Nieper-Wißkirchen (10 Jun 2021 11:19 UTC)
Re: Reviewing named and optional parameters John Cowan (12 Jun 2021 22:09 UTC)
Re: Reviewing named and optional parameters Daphne Preston-Kendal (21 Jun 2021 07:22 UTC)
Re: Reviewing named and optional parameters Daphne Preston-Kendal (21 Jun 2021 10:37 UTC)
Re: Reviewing named and optional parameters Daphne Preston-Kendal (29 Jul 2021 09:42 UTC)
Re: Reviewing named and optional parameters John Cowan (29 Jul 2021 23:34 UTC)
Re: Reviewing named and optional parameters Daphne Preston-Kendal (30 Jul 2021 07:03 UTC)
Re: Reviewing named and optional parameters Marc Nieper-Wißkirchen (30 Jul 2021 07:31 UTC)
Re: Reviewing named and optional parameters John Cowan (30 Jul 2021 21:40 UTC)
Re: Reviewing named and optional parameters Marc Nieper-Wißkirchen (30 Jul 2021 21:48 UTC)
Re: Reviewing named and optional parameters John Cowan (30 Jul 2021 21:50 UTC)
Re: Reviewing named and optional parameters Marc Nieper-Wißkirchen (30 Jul 2021 21:59 UTC)
Re: Reviewing named and optional parameters John Cowan (30 Jul 2021 21:32 UTC)
Re: Reviewing named and optional parameters Daphne Preston-Kendal (31 Jul 2021 10:02 UTC)
Re: Reviewing named and optional parameters Marc Nieper-Wißkirchen (31 Jul 2021 10:29 UTC)
Re: Reviewing named and optional parameters John Cowan (31 Jul 2021 17:33 UTC)
Re: Reviewing named and optional parameters Daphne Preston-Kendal (31 Jul 2021 17:46 UTC)
Re: Reviewing named and optional parameters Marc Nieper-Wißkirchen (31 Jul 2021 18:04 UTC)
Re: Reviewing named and optional parameters John Cowan (31 Jul 2021 19:52 UTC)
Re: Reviewing named and optional parameters Daphne Preston-Kendal (02 Dec 2021 17:57 UTC)
Re: Reviewing named and optional parameters Jeronimo Pellegrini (03 Dec 2021 03:32 UTC)

Re: Reviewing named and optional parameters Marc Feeley 09 Jun 2021 13:10 UTC

> On Jun 9, 2021, at 8:40 AM, Marc Nieper-Wißkirchen <xxxxxx@nieper-wisskirchen.de> wrote:
>
>
> > I too can imagine situations where having keyword arguments only on macros would be restrictive:
> >
> > 1) In an object oriented programming style where you call a virtual method through generic call.  The generic call site specifies keyword arguments and there is a dispatch to the actual procedure that does the work that consumes the keyword arguments.
> >
> > The actual procedure can be implemented as a procedure just taking positional arguments. Some nice syntactic abstraction can help to map keyword arguments to positional arguments. I think this would at least also solve point 2) below. I cannot say much about 3) because there is no generally agreed FFI for Scheme and, further, the semantics of keyword arguments in the FFI targets may not be the same or be compatible.
> >
> > 2) In higher order procedures whose procedure parameter accepts keyword arguments.  Syntax isn’t a first-class object that can be passed around.
> >
> > 3) In a FFI between Scheme and a foreign language that supports keyword arguments (Python, Ruby, Common Lisp, Ada, C#, Fortran, R, PHP,  Scala, Smalltalk, etc).
>
> The situations I’m describing can be caracterized as only knowing at run time which set of keyword arguments are allowed and what they mean.  Handling keyword arguments fully at compile time (through macros or some form of compile-time type checking) is thus not general enough.
>
> Could you give a brief code example that would illustrate a real use?
>

A neat dynamic use is sending a procedure to a peer to be executed there (as is possible with Termite):

  % gsi
  Gambit v4.9.3-1427-g46618e76

  > (define (n2s n #!key (base 10)) (number->string n base))
  > (define network (open-string)) ;; in real life a network connection
  > (write (object->u8vector n2s) network) ;; send the procedure to the peer
  > (define f (u8vector->object (read network))) ;; on the peer side
  > (f 49374 base: 16)
  "c0de"
  > (f 49374)
  "49374"

Here’s a second example for a FFI to Python (which is WIP):

  (import (_six python))
  \import math
  (define math.isclose \math.isclose)
  (math.isclose 1.3 1.2)              ;; => #f
  (math.isclose 1.3 1.2 rel_tol: 0.3) ;; => #t

In both cases the acceptable keywords are only known at run time.

Marc