3 ms·
Have any examples of languages that implement this?
by skynirka 15y ago
Have any examples of languages that implement this?
- elevenE 15y agoIIRC, INTERCAL does implement it.
- ryandvm 15y agoSome 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)
- InclinedPlane 15y agoTo some extent any inversion of control style framework works like this. It can be more or less befuddling depending on the straightforwardness of the framework. Declarative style programming such as sql, xslt, or msbuild also tend to work this way, which can be maddening to debug.
- audreyt 15y agoThere's a CPAN module for it in Perl 5 (with support for fork() on parallel comefroms): http://search.cpan.org/dist/Acme-ComeFrom/lib/Acme/ComeFrom.pm http://search.cpan.org/dist/Acme-ComeFrom/lib/Acme/ComeFrom....