3 ms·
Some elements of Aspect Oriented Programming are comparable to the COMEFROM statement. http://en.wikipedia.org/wiki/Aspect-oriented_programming#See_also http:/
by ryandvm 15y ago
Some elements of Aspect Oriented Programming are comparable to the COMEFROM statement.
http://en.wikipedia.org/wiki/Aspect-oriented_programming#See_also http://en.wikipedia.org/wiki/Aspect-oriented_programming#See...
- brlewis 15y agoHere's an AOP-style comefrom syntax you can play with by setting DrRacket's language to R5RS: (define-syntax comefrom (syntax-rules () ((comefrom function expr ...) (let ((old-function function)) (set! function (lambda args (begin expr ...) (apply old-function args))))))) (define (square x) (* x x)) (define (hypotenuse a b) (sqrt (+ (square a) (square b)))) (comefrom square (display "I'm a square!\n")) (hypotenuse 3 4) The example in the Wikipedia article is more like this: (define-syntax comefrom (syntax-rules () ((comefrom function) (call-with-current-continuation (lambda (here) (set! function here)))))) (define (noop) ; Do nothing #t) (define (main) (let ((i 0)) (comefrom noop) (if (< i 5) (begin (set! i (+ i 1)) (display "Hello world!\n") (noop))))) (main)