Email list hosting service & mailing list manager

specification by implications and example Matthias Felleisen (16 Jan 2000 14:49 UTC)
Re: specification by implications and example Per Bothner (16 Jan 2000 21:33 UTC)
Re: specification by implications and example Shriram Krishnamurthi (16 Jan 2000 23:28 UTC)
Re: specification by implications and example Per Bothner (17 Jan 2000 00:14 UTC)
Re: specification by implications and example Matthias Felleisen (17 Jan 2000 00:34 UTC)
Re: specification by implications and example Shriram Krishnamurthi (17 Jan 2000 00:52 UTC)
Re: specification by implications and example Per Bothner (17 Jan 2000 01:38 UTC)

Re: specification by implications and example Per Bothner 17 Jan 2000 01:38 UTC

Shriram Krishnamurthi <xxxxxx@cs.rice.edu> writes:

> > But this is allowed:
> >         (set! ((if (random) car cdr) x) v)
>
> But when Matthias asked whether the grammar was
>   (set! exp exp)
> you said "No - that would be ambiguous".  I took a guess as to what
> that might mean, but you say my guess at something that would be
> erroneous is "valid syntactically".  So now I know neither what the
> comment about ambiguity refers to nor what the SRFI permits.

`((if (random) car cdr) x)' is not an expression in this context,
just like `x' is not an expresion in the context of `(set! x v)'.
In both cases, they could be called "lvalue expressions", but
Scheme does not have such a concept.

The indended definition is this and nothing more:

(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))))
--
	--Per Bothner
xxxxxx@bothner.com   http://www.bothner.com/~per/