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

Re: specification by implications and example

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



Matthias Felleisen <matthias@xxxxxxxx> writes:

> >> The special form set! is extended so the first operand can be a procedure
> application,
> >> and not just a variable.
> The examples that follow, however, are all of the shape (set!  (procedure-name
> ...) ...).

> The examples that follow, however, are all of the shape
>  (set!  (procedure-name ...) ...)

That *is* a procedure application.  I guess the correct R5RS terminology
is that the first set! operand can be a "procedure call".

> So, where is the syntax specification for this new/extended form? In this day
> and age, that's the
> minimum we can expect. Is it
> 
>   (set!  exp exp)

No - that would be ambiguous.

> or
> 
>   (set! (p exp ...) exp)
> 
> or what?

The latter.

> Also,  if what we see is all there is to it, I would think that a syntax-rules
> specification  can be written.
> If so, supply it.

(define-syntax set!
  (syntax-rules ()
    ((set! (proc args ...) value)  ;; Assuming Alternative 1
     ((setter proc) args ... value))
    ;; ((set! (proc args ...) value) ;; Assuming Alternative 2
    ;;  ((setter proc) value args ...))
    ((set! var value)
     (%%builtin-set! var value))))

-where %%builtin-set! is set! as defined in R5RS.

I didn't include it partly because I don't believe
        ((setter proc) args ... value)
is a valid R5RS template.  However, it's meaning should be clear.
-- 
	--Per Bothner
per@xxxxxxxxxxx   http://www.bothner.com/~per/