[Chicken-users] Internal compiler error on use bindings

2012-03-20 Thread Mark Carter
Here's one for your mystery file:

foo.scm:
(use bindings)
(bind (a b c) '(1 2 3)
(print a))
(write-line Finished)


$ csj -bq foo.scm
1
Finished

BUT:

$ csc foo.scm

Error: [internal compiler error] type of literal not supported: #procedure

Call history:

syntax  (##core#begin (write-line Finished))
syntax  (write-line Finished)   --

Error: shell command terminated with non-zero exit status 17920: 
/home/mcarter/.local/bin/chicken foo.scm -output-file foo.c



FYI:
$ csi

CHICKEN
(c)2008-2011 The Chicken Team
(c)2000-2007 Felix L. Winkelmann
Version 4.7.0.5-st 
linux-unix-gnu-x86 [ manyargs dload ptables ]
compiled 2012-03-07 on miro (Linux)


___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Internal compiler error on use bindings

2012-03-20 Thread Peter Bex
On Tue, Mar 20, 2012 at 01:11:14PM +, Mark Carter wrote:
 Here's one for your mystery file:
 
 foo.scm:
   (use bindings)
   (bind (a b c) '(1 2 3)
   (print a))
   (write-line Finished)
 
 
 $ csj -bq foo.scm
 1
 Finished
 
 BUT:
 
 $ csc foo.scm
 
 Error: [internal compiler error] type of literal not supported: #procedure
 
 Call history:
 
 syntax  (##core#begin (write-line Finished))
 syntax  (write-line Finished)   --

That's a bug in the bind egg.  It is a macro that returns procedure
objects instead of the name that refers to the procedure.

In the interpreter that's allowed but the compiler doesn't know
how to serialize them.

You can easily see this in the interpreter by typing ,x (bind ...):
#;2 ,x (bind (a b c) '(1 2 3)  

 
(print a))  
 
(##core#let
  ((a ('#procedure '(1 2 3) 0))
   (b ('#procedure '(1 2 3) 1))
   (c ('#procedure '(1 2 3) 2)))
  (if (and ('#procedure ('#procedure '(1 2 3) 3)))
(begin (print a))
(#%error
  'bind
  (#%sprintf
(sub)sequence in ~A too long to match (sub)pattern in ~A~%
'(1 2 3)
'(a b c)

The if for example is easy to fix:
(and ,@(map (lambda (x) `(',empty? ,x)) checks))
I think this should be:
(and ,@(map (lambda (x) `(empty? ,x)) checks))

I don't know if Juergen (the bindings maintainer) is reading this
mailinglist, otherwise it's probably a good idea to file a bug in trac
and/or mail him about it.

Cheers,
Peter
-- 
http://sjamaan.ath.cx
--
The process of preparing programs for a digital computer
 is especially attractive, not only because it can be economically
 and scientifically rewarding, but also because it can be an aesthetic
 experience much like composing poetry or music.
-- Donald Knuth

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users