guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ECMAScript support broken?


From: Noah Lavine
Subject: Re: ECMAScript support broken?
Date: Sun, 2 Jan 2011 22:19:45 -0500

Hi all,

I looked at this. For the first error, I think the bug is in (language
ecmascript compile-tree-il), where the file around line 369 says:

      ((object . ,args)
           (@impl new-object
                  (map (lambda (x)
                         (pmatch x
                                 ((,prop ,val)
                                  (-> (apply (-> (primitive 'cons))
                                             (-> (const prop))
                                             (comp val e))))
                                 (else
                                  (error "bad prop-val pair" x))))
                       args)))

This produces (@impl new-object ()) if args is '(), but it should just
be (@impl new-object). I tried changing that bit to

      ((object . ,args)
       (if (null? args)
           (@impl new-object)
           (@impl new-object
                  (map (lambda (x)
                         (pmatch x
                                 ((,prop ,val)
                                  (-> (apply (-> (primitive 'cons))
                                             (-> (const prop))
                                             (comp val e))))
                                 (else
                                  (error "bad prop-val pair" x))))
                       args))))

and it now works. (It's terribly hackish - does anyone have a better
solution?) I don't have time to look at the rest right now, but I'll
try to soon unless someone else figures it out (please :-) ).

Noah


On Sun, Jan 2, 2011 at 11:46 AM, Kan-Ru Chen <address@hidden> wrote:
> Hi,
>
> I recently want to start a small project that uses guile as the
> JavaScript interpreter, but the current git HEAD has errors regard
> object definition.
>
> --8<---------------cut here---------------start------------->8---
> scheme@(guile-user)> ,L ecmascript
> Happy hacking with ECMAScript!  To switch back, type `,L scheme'.
> ecmascript@(guile-user)> var test = {};
> While compiling expression:
> ERROR: unrecognized tree-il ()
> ecmascript@(guile-user)> var test = { bar: 1 };
> While compiling expression:
> ERROR: unrecognized tree-il ((apply (primitive cons) (const bar) (const 1)))
> --8<---------------cut here---------------end--------------->8---
>
>
> Happy new year!
> Kanru
> --
> A badly written book is only a blunder. A bad translation of a good
> book is a crime.
>                -- Gilbert Highet
>
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]