Permalink
Browse files

make use-load overridable

  • Loading branch information...
1 parent 474b25a commit 46d6d347eb70c5656c1fad8f06b179747ab3723b @awwx awwx committed Jun 9, 2011
Showing with 17 additions and 2 deletions.
  1. +1 −0 ar.arc
  2. +4 −0 override-use-load-test-helper.arc
  3. +9 −0 override-use-load.t
  4. +2 −1 run
  5. +1 −1 run.ss
View
1 ar.arc
@@ -31,6 +31,7 @@
(racket-hash-set! sig (racket-quote instring) (ar-toarc (racket-quote (str))))
(racket-hash-set! sig (racket-quote outstring) (ar-toarc (racket-quote ())))
(racket-hash-set! sig (racket-quote uniq) (ar-toarc (racket-quote ())))
+ (racket-hash-set! sig (racket-quote use-load) (ar-toarc (racket-quote (item))))
(racket-hash-set! sig (racket-quote ar-toarc) (ar-toarc (racket-quote (x))))
(racket-define-syntax-rule (ar-def name signature . body)
@@ -0,0 +1,4 @@
+(use arc)
+
+(defrule use-load (is item 'foo)
+ (prn "foo!"))
View
@@ -0,0 +1,9 @@
+(use test-by-example)
+
+(example-test (runtime '(override-use-load-test-helper)) #<<.
+
+> (use foo)
+prints: foo!\n
+
+.
+)
View
3 run
@@ -60,7 +60,8 @@
(begin
(if (eqv? (string-ref arg 0) #\-)
(do-option runtime arg)
- (do (lambda () (use-load runtime arg))))
+ (do (lambda ()
+ ((runtime-get runtime 'use-load) arg))))
(loop)))))))
(doit)
View
2 run.ss
@@ -25,7 +25,7 @@
(cdr form)))
((and (pair? form) (eq? (car form) 'use))
(for-each (lambda (item)
- (use-load runtime item))
+ ((runtime-get runtime 'use-load) item))
(cdr form)))
(else
(error "sorry, this primitive eval only knows how to do ail-code and use!" form))))

0 comments on commit 46d6d34

Please sign in to comment.