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 Daphne Preston-Kendal 09 Jun 2021 09:42 UTC

On 9 Jun 2021, at 11:13, Marc Nieper-Wißkirchen <xxxxxx@nieper-wisskirchen.de> wrote:

> Am Mi., 9. Juni 2021 um 10:50 Uhr schrieb Daphne Preston-Kendal <xxxxxx@nonceword.org>:
> On 7 Jun 2021, at 18:07, Marc Nieper-Wißkirchen <xxxxxx@nieper-wisskirchen.de> wrote:
>
> >> One thing I'm already aware of: in the conclusion, I mention that it would be nice to have compiler macros in Scheme; at the time, I was unaware that R6RS Schemes effectively have them through the ability to have syntax patterns match an identifier out of first-position context, and that this is on the ballot for R7RS as part of syntax-case. One thing I'd like to know, not only in this context, is what (potential) implementers of R7 think of this: Do you think you could implement it?
>
> What is the definition of a compiler macro exactly? It's not a term that appears in any of the RnRS, I think.

http://www.lispworks.com/documentation/HyperSpec/Body/26_glo_c.htm#compiler_macro

Essentially, in Scheme terms, a macro which is exported under the same name as a procedure, so that procedure can get some compile-time optimization at its call site when it's used like a macro (in first position under its own name).

You can do this with R6RS's identifier syntax by doing something like the following:

(define (%+ . args) [… the procedure which adds numbers together …])
(define-syntax +
  (lambda (stx)
    (syntax-case stx ()
      ((_ . args) [… do constant folding if possible, otherwise just expand to a call to %+ …])
      (_ #'%+))))

> I have also implemented identifier syntax in Chicken for a test. It took me two hours and I hadn't taken a look at Chicken's codebase before. So I don't see any principle problems.

Good to know!

> I don't understand your example with
>
> (let ((foo 'example))
>   foo)
>
> A Scheme implementation where this would not evaluate to "foo" when "foo" is bound to a syntax transformer outside the form, would not be a conforming implementation (whether of R5RS, R6RS, or R7RS).

Perhaps it was a bad idea to use a bare identifier as an example. Here's Bigloo, for example:

1:=> (define-syntax foo (syntax-rules () ((_) 'syntax)))
#unspecified
1:=> (let ((foo (lambda () 'procedure))) (foo))
syntax

If that behaviour were extended to identifier syntax, it would be non-conforming in R6's syntax-case, but I don't know how much effort it would be for Bigloo to ‘fix’ this. Nor am I sure if *this* is actually a violation of R5RS or R7RS small. (From a quick survey, Chicken, Chibi, Kawa, and Gauche already return 'procedure at their respective REPLs. It would be handy to have a more thorough survey, especially of explicitly non-R6RS Schemes.)

> If we get rich enough syntactic abstractions, I already wondered (in the context of SRFI 177) whether there is really a need for first-class procedures that take keyword arguments or whether they should all become special forms (with absolutely no runtime overhead). After all, an unknown procedure (a procedure passed around as a first-class value) would very seldom be called with keyword arguments.

I considered the possibility of making everything a macro, but I decided losing first-class status of procedures was too high a price to pay, on principle if nothing else. True, it's unlikely (though not impossible) that an arbitrary higher-order procedure (as in map, fold and their respective first arguments) will use keyword arguments, but I can imagine not-so-contrived situations where it would still be useful to pass them around.

But perhaps it would be acceptable to have something where you'd define a version of a procedure with positional arguments which is first-class, then a meta-macro to get a keyword version of it? Hmm.

Daphne