Thanks to both of you.
It does expand to a reasonably large amount of code, a small example is
below. The processing that define-schema does shouldn't be worse than
O(N*M) where N is the number of tables and M is the number of unique
procedure names. Which is not linear, but also probably not large enough to
be the main culprit. I added `(println stx-being-returned)` to
define-schema and it gets printed relatively quickly. So probably the size
of the generated code is the main culprit. I'll try Ryan C's tips as soon
as I have time; they look promising.
(define-schema $$
(table A
#:property
[foo (%%scalar "foo-given-A" this)])
(table B
#:property
[foo (%%scalar "foo-given-B" this)]
[bar (%%scalar "bar-given-B" this)]))
; Approximately expands to
#;(begin
(define A (make-table 'A))
(define B (make-table 'B))
(define (foo x)
(cond
[((instanceof A) x)
(%%scalar "foo-given-A" x)]
[((instanceof B) x)
(%%scalar "foo-given-B" x)]
[else (error "expected instanceof A or B, got" x)]))
(define (bar x)
(cond
[((instanceof B) x)
(%%scalar "bar-given-B" x)]
[else (error "expected instanceof B, got" x)])))
--
You received this message because you are subscribed to the Google Groups
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/racket-users/9900daba-8dd8-4e46-88ef-84fdeb53f11fo%40googlegroups.com.