Although maybe off-topic regarding macrology:
You might want to consider factoring out the generally useful part,
which I think is the less-verbose accessors.
An already less verbose way is to use match-define or match-let, for example:
(struct s (a b c))
(define x (s 1 2 3))
(match-define (s a
Very helpful, thank you. You're right that the #:methods spec was messing
up the original macro, too. Though it had some other problems after I got
beyond that hurdle.
Every time I think I am starting to understand macros I find out I don't.
Deren
On Tue, Aug 18, 2015 at 12:43 AM, Alexander D. K
I'm not sure why that doesn't work, but I redid it with my define-struct-fields
macro factored out and this worked:
I'm not sure but I suspect the real difference comes from passing gen:printable
to the pstruct macro though, because that's what causes this to fail.
I also had to add the optional
Thanks for your help Alexander. I did have this much working alright in a
different manner. What I guess I wanted was that this syntax was introduced
per struct so that the same syntax worked for all interface-structs. That
is, if I
(interface-struct test (a b c)
[(define (some-interface-function
Are you looking for a macro like this:
#lang racket
(require syntax/parse/define (for-syntax racket/syntax))
(define-simple-macro (define-struct-fields struct:id (field:id ...) v:expr)
#:with s (generate-temporary #'struct)
#:with [struct-field ...]
(for/list ([field (in-list (syntax->list #'
5 matches
Mail list logo