mixin-lang: mixing languages together
Danny Yoo <dyoo@cs.wpi.edu>
1 Introduction
I want to be able to mixin languages together.
Let’s say that I want to take any language, treat it as a parent, and then add my custom #%app binding to it.
It’s possible to do this by hand, but I want to make it stupid-easy. I would love to be able to say:
"my-traced-racket.rkt"
#lang planet dyoo/mixin-lang/apply
racket
#:mixin "trace-mixin.rkt"
"trace-mixin.rkt"
#lang planet dyoo/mixin-lang/mixin
(define-syntax-rule (#%app operator operands ...)
(let ([op-v operator])
(begin (printf "Application with ~s" (object-name op-v))
;; parent-trap?
(#%parent-#%app op-v operands ...))))
(provide #%app)
The application of the mixin should generate the necessary module code that combines racket with "trace-mixin.rkt". The end result should be a new module language that, for the most part, is racket, except for the overridden #%app binding. The mixin module should be able to use the parent bindings, because they should all be prefixed with #%parent-....