That's an awesome trick, Marc. Thanks!
But still.. I don't see any difference:
> (define-type context
id: a0000000-0000-0000-0000-000000000000
constructor: macro-make-context
macros:
;; opaque: WITHOUT OPAQUE
unprintable:
a)
(begin
(##define-macro (macro-make-context p1) (##list '(let () (##declare (extended-bindings)) ##structure) ''#<type #19 context> p1))
(##define-macro (make-constant-context p1) (##define-type-construct-constant 'make-constant-context '#<type #19 context> p1))
(##define-macro (context? obj) `((let () (##declare (extended-bindings)) ##structure-direct-instance-of?) ,obj ,''##type-1-a0000000-0000-0000-0000-000000000000))
(##define-macro (context-a obj) (##list '(let () (##declare (extended-bindings)) ##direct-structure-ref) obj 1 ''#<type #19 context> #f))
(##define-macro (context-a-set! obj val) (##list '(let () (##declare (extended-bindings)) ##direct-structure-set!) obj val 1 ''#<type #19 context> #f)))
> (define-type context
id: a0000000-0000-0000-0000-000000000000
constructor: macro-make-context
macros:
opaque: ;; WITH OPAQUE
unprintable:
a)
(begin
(##define-macro (macro-make-context p1) (##list '(let () (##declare (extended-bindings)) ##structure) ''#<type #20 context> p1))
(##define-macro (make-constant-context p1) (##define-type-construct-constant 'make-constant-context '#<type #20 context> p1))
(##define-macro (context? obj) `((let () (##declare (extended-bindings)) ##structure-direct-instance-of?) ,obj ,''##type-1-a0000000-0000-0000-0000-000000000000))
(##define-macro (context-a obj) (##list '(let () (##declare (extended-bindings)) ##direct-structure-ref) obj 1 ''#<type #20 context> #f))
(##define-macro (context-a-set! obj val) (##list '(let () (##declare (extended-bindings)) ##direct-structure-set!) obj val 1 ''#<type #20 context> #f)))
I noticed that some attributes produce no difference in the output, but will somehow set some internal flag of Gambit. That's the case of :unprintable, which makes a difference when pretty-printing the object but produces no difference in the generated function/macros. If this is the case, what does opaque: actually do?