[plt-scheme] AOP interactions with (PLT) Scheme

From: Noel Welsh (noelwelsh at yahoo.com)
Date: Fri Feb 16 16:43:19 EST 2007


I'm trying to add a new feature to SchemeUnit.  In SchemeUnit:

  Test = Test-Suite String (list-of Test) | Test-Case String Thunk

A number of people would like SchemeUnit to automagically add test-cases to a default test-suite (so test cases are no longer values).  A number of others  would like the existing behaviour to remain.

This seems suspiciously AOPish.  In some context an expression like

  (test-case "Foo" (check-= 1 2))

[Note: this is a macro that expands to make-test-case]

evaluates to a value (a Test-Case).  In other contexts it evaluates to a side-effect like

  (add-to-default-suite! <a test case value>)

The Problem:

I'd like my implementation to have these properties:

1. There are a bunch of things that expand into test-case.  They should be oblivious as which context they are in.

2. Ideally the context would be module scoped and chosen based on which SchemeUnit collection is required.  So

  (require (planet "test.ss" ("schematics" "schemeunit.plt")))

get the original context and

  (require (planet "littleunit.ss" ("schematics" "schemeunit.plt"))))

gets the new automagic context

3. The original SchemeUnit code should be oblivious to the fact it is being used with aspects.

Clearly if I modify the original SchemeUnit code (breaking requirement 3) I can get what I want.  I just need to make test-case aware of the current context.

Finally, The Question:

It seems that all 3 requirements can't be implemented in PLT Scheme.  I think my requirements break hygiene and break the module system's prohibition on redefining names.


1. Is there a way to implement what I want?

2. Does anyone have any enlightenment to pass on regarding the tradeoffs made wrt hygiene/the module system and meta/aspect-oriented programming?  Are they fundamentally at odds, or can they be unified with some encompassing concept?

Many thanks,

Never miss an email again!
Yahoo! Toolbar alerts you the instant new Mail arrives.

Posted on the users mailing list.