Peter Bex wrote: > On Sat, May 04, 2019 at 03:56:12PM +0200, Marco Maggi wrote: >> ... in CHICKEN 5.0.0 or in a future release? I can find nothing >> relevant on the CHICKEN Wiki. Here what they should do:
>> <http://marcomaggi.github.io/docs/vicare-scheme.html/iklib-expander-etv.html> >> it would open a can of worms^H^H^H^H^H possibilities. > Hi Marco, > This seems like a superfluous feature to me. > To give an example of the first example on the page you linked, > I would use this in a begin-for-syntax, like so: > (begin-for-syntax > (define obj1 (+ 1 2 3))) > (define-syntax get-obj1 > (er-macro-transformer > (lambda (e r c) > obj1))) > (get-obj1) => 6 > Maybe I'm missing something, but this seems much simpler to me. That example just shows the mechanism, and it is not really a good example (I wrote it). What I am thinking of, as reference scenario, is an infix-to-prefix macro with infrastructure that allows to define new binary operators, in which the operator name is not necessarily equal to the name of the function that implements the operation itself. So it should go like this: (define (spiffy-operation X Y) (do-something-spiffy-with X Y)) (define-infix-binary-operator spiffy (right-binding-power 55) ... (procedure spiffy-operation)) (infix 2 * 3 + 88 spiffy 99) the use of the macro DEFINE-INFIX-BINARY-OPERATOR should expand into something like: (define-syntax spiffy (make-expand-time-value (make-infix-operator 55 ... spiffy-operation))) and the macro INFIX should parse its input form and retrieve the record instance of type "infix-operator" with code like: (if (expand-time-value? token) (let ((etv (retrieve-expand-time-value token))) (if (infix-operator? etv) (process-the-operator etv) ---)) ---) I think that Racket's implementation of the infix-to-prefix syntax does something like this (I have not checked). Another use case, if the identifier "<fixnum>" is bound to an appropriate expand-time value, we could expand. (define* (doit {X <fixnum>} {Y <fixnum>}) ---) into: (define (doit X Y) (assert (fixnum? X)) (assert (fixnum? Y)) ---) -- Marco Maggi _______________________________________________ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users