diff --git a/examples/using-resources.rkt b/examples/using-resources.rkt index 2b4c7ce..aff657b 100644 --- a/examples/using-resources.rkt +++ b/examples/using-resources.rkt @@ -4,10 +4,22 @@ (planet dyoo/whalesong/image)) (define-resource whale-resource "images/humpback.jpg") +(define-resource self-resource "using-resources.rkt") (define whale-image (image-url (resource->url whale-resource))) -whale-image -whale-image \ No newline at end of file +(list whale-image whale-image) +(resource? whale-image) +(image? whale-image) + + +(list whale-resource whale-resource) +(resource? whale-resource) +(image? whale-resource) + + +(list self-resource self-resource) +(resource? self-resource) +(image? self-resource) diff --git a/image/private/kernel.js b/image/private/kernel.js index e2cf1ba..e9aae7e 100644 --- a/image/private/kernel.js +++ b/image/private/kernel.js @@ -70,12 +70,6 @@ var isPointsCount = function(x) { -var imageSignature = { updatePinhole : function() {}, - getHeight : function() {}, - getWidth: function() {}, - getBaseline : function() {}, - render: function() {} }; - // Produces true if thing is an image-like object. diff --git a/resource/compile-time.rkt b/resource/compile-time.rkt index 759e83b..765ec42 100644 --- a/resource/compile-time.rkt +++ b/resource/compile-time.rkt @@ -11,6 +11,7 @@ (provide define-resource) (require "structs.rkt") +(require "specialize/impl.rkt") ;; file-resource: @@ -45,4 +46,5 @@ (record-resource resolved-module-path normal-path munged-path))) ;; Run time code - (define name (resource normal-path munged-path content))))))])) + (define name (specialize! + (resource normal-path munged-path content)))))))])) diff --git a/resource/main.rkt b/resource/main.rkt index e97d9c9..7404f8d 100644 --- a/resource/main.rkt +++ b/resource/main.rkt @@ -1,6 +1,8 @@ #lang s-exp "../lang/kernel.rkt" (require "compile-time.rkt" - "runtime.rkt") + "runtime.rkt" + "structs.rkt") (provide (all-from-out "compile-time.rkt" - "runtime.rkt")) + "runtime.rkt") + resource?) diff --git a/resource/specialize/impl.rkt b/resource/specialize/impl.rkt new file mode 100644 index 0000000..f5c3b8e --- /dev/null +++ b/resource/specialize/impl.rkt @@ -0,0 +1,8 @@ +#lang s-exp "../../lang/js/js.rkt" + +(require "../structs.rkt") + +(declare-implementation + #:racket "racket-impl.rkt" + #:javascript ("js-impl.js") + #:provided-values (specialize!)) diff --git a/resource/specialize/racket-impl.rkt b/resource/specialize/racket-impl.rkt new file mode 100644 index 0000000..cbe9e9b --- /dev/null +++ b/resource/specialize/racket-impl.rkt @@ -0,0 +1,5 @@ +#lang racket/base +(provide specialize!) + +(define (specialize! resource) + resource)