starting to work on resources

This commit is contained in:
Danny Yoo 2011-08-12 12:48:42 -04:00
parent 2d695d700a
commit bc8369b25c
3 changed files with 42 additions and 12 deletions

View File

@ -1,5 +1,10 @@
#lang s-exp "kernel.rkt"
(provide (all-from-out "kernel.rkt")
#;(all-from-out "private/list.rkt"))
(provide (except-out (all-from-out "kernel.rkt")
)
;;(all-from-out "private/list.rkt")
)
(require racket/private/modbeg
#;"private/list.rkt")
;"private/list.rkt"
)

View File

@ -61,7 +61,7 @@
e
null
#%plain-module-begin
#%module-begin
(rename-out [my-module-begin #%module-begin])
#%datum
#%app
#%top-interaction
@ -69,6 +69,7 @@
module
define
define-values
let-syntax
let-values
let*-values
define-struct
@ -433,4 +434,21 @@ symbol->string
(error 'set-car! "Not available outside JavaScript context."))
(define (set-cdr! x v)
(error 'set-car! "Not available outside JavaScript context."))
(error 'set-car! "Not available outside JavaScript context."))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define-syntax (my-module-begin stx)
(syntax-case stx ()
[(_ body ...)
(with-syntax ([(expanded-body ...)
(local-expand #'(body ...)
'module-begin
#f)])
(syntax/loc stx
(#%module-begin expanded-body ...)))]))

View File

@ -11,12 +11,19 @@
;; file-resource:
;;
(define-for-syntax (file-resource stx)
(define-syntax (file-resource stx)
(syntax-case stx ()
[(_ path)
(syntax/loc stx
(let-syntax ([compile-time-code
(lambda (stx)
(displayln "at compile time")
#'(void))])
(resource path)))]))
(let ([dontcare
(syntax-local-lift-expression #'(begin
(begin-for-syntax
(printf "Compile time code executing"))
(void)))])
(syntax/loc stx
(let-syntax ([compile-time-code
(lambda (stx)
(printf "compile time code executing\n")
#'(void))])
(begin
;;dontcare
(resource path)))))]))