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

Re: Sample implementation



>Thanks!  That looks pretty good.  Two nits:
>
>> (define-syntax set! let*
>>   (syntax-rules ()
>>     ((set! (?e0 ?e1 ...) ?v)
>>      ((setter ?e0) ?e1 ... ?v))
>>     ((set! ?i ?v)
>>      (set! ?i ?v))))
>
>Why the question-marks?  It makes it look like they have
>some syntactic signifigance, but it is really just a
>naming convention.  Is it a common naming convention?

Well, they do have syntactic significance: they are used to prefix
pattern variables only... :-)

I see it often enough, and the thing is, in large macros that introduce
new bindings they help distinguishing pattern variables from those
introduced by the macro.  For example, I sometimes find myself doing
stupid things like

	(define-syntax foo
	  (syntax-rules
	    ((foo e)
	     (let ((e e))  ; evaluate e once
	       ... use e here ...))))

which doesn't work.  If I use ?e for the pattern variable then I am
forced to think about when I am using a pattern variable, which helps me
avoid stupid mistakes like above, and others.

--lars