dyoo / whalesong

Whalesong: Racket to JavaScript compiler
http://hashcollision.org/whalesong
250 stars 30 forks source link

Usage of view-bind-many gives expansion error #79

Closed soegaard closed 12 years ago

soegaard commented 12 years ago

Hi,

The following expression

(view-bind-many (->view dom) 
                ["answer_input_1" "keyup" on-keyup/answer-input]
                ["answer_button" "click"  on-answer-button-click])

gives this error

expand: unbound identifier in module in: unsyntax

(The equivalent view-bind-many* expressions works fine.)

dyoo commented 12 years ago

Thanks, will investigate.

soegaard commented 12 years ago

I suspect the first #' in the fold-expressions should be an #` .

;; A syntactic form to make it more convenient to focus and bind multiple things ;; (view-bind-many a-view ;; [id type function] ;; [id type function] ...) (define-syntax (view-bind-many stx) (syntax-case stx () [(_ a-view [a-selector a-type a-function] ...) (foldl (lambda (a-selector a-type a-function a-view-stx)

'(view-bind (view-focus #,a-view-stx #,a-selector)

                       #,a-type
                       #,a-function))
        #'a-view
        (syntax->list #'(a-selector ...))
        (syntax->list #'(a-type ...))
        (syntax->list #'(a-function ...)))]))
dyoo commented 12 years ago

On Mon, Feb 13, 2012 at 10:48 AM, Jens Axel Søgaard reply@reply.github.com wrote:

I suspect the first #' in the fold-expressions should be an #` .

Agreed! Fixing this now. Let me add a test case for this as well.

dyoo commented 12 years ago

On Mon, Feb 13, 2012 at 11:09 AM, Danny Yoo dyoo@cs.wpi.edu wrote:

On Mon, Feb 13, 2012 at 10:48 AM, Jens Axel Søgaard reply@reply.github.com wrote:

I suspect the first #' in the fold-expressions should be an #` .

Agreed!  Fixing this now.  Let me add a test case for this as well.

Fix in c8e0b848b63d11a7e3df5f36e722e24cb83ece6b; I'll get a version of Whalesong released later tonight that includes this.

dyoo commented 12 years ago

Ok, added example in web-world/examples/color-buttons.rkt. This will be in the next release.