1 Introduction
Version: 5.1.1

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:


#lang planet dyoo/mixin-lang/apply


#:mixin "trace-mixin.rkt"

where "trace-mixin.rkt" looks like this:


#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-....