Hello again, Second problem solved as well. The attached patch fixes both issues. Anything else you notice being wrong with ecmascript? (I mean our implementation of it, of course ...) Noah On Sun, Jan 2, 2011 at 10:19 PM, Noah Lavine wrote: > 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 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 >> >> >