chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Re: problem with callbacks


From: Felix Winkelmann
Subject: Re: [Chicken-users] Re: problem with callbacks
Date: Fri, 23 Jan 2004 08:21:47 +0100
User-agent: Opera7.21/Win32 M2 build 3218

Am Thu, 22 Jan 2004 12:21:41 -0500 (EST) hat Daniel B. Faken <address@hidden> geschrieben:


I observe this behaviour with Chicken 1.30 (under redhat 7.3):
compiling with 'csc tst.scm' and running './tst':

---- (1) program as shown above
gloriot2:~/cr/spu/viewpoint/htcam%./tst
foo is #<hash-table>
test_fn(50): before callback
callback-val is 50
Error: unprintable non-immediate object encountered

tst.scm: 3    make-hash-table
tst.scm: 5    make-hash-table
tst.scm: 23   print
tst.scm: 25   test_fn
##sys#gc
tst.scm: 18   print
tst.scm: 19   print
in callback: foo is gloriot2:~/cr/spu/viewpoint/htcam%

Right, it doesn't see the lexical variable.

--- (2) compiling program with '(scm_callback 3)' uncommented:
gloriot2:~/cr/spu/viewpoint/htcam%csc tst.scm
tst.c: In function `scm_callback':
tst.c:68: `f_65' undeclared (first use in this function)
tst.c:68: (Each undeclared identifier is reported only once
tst.c:68: for each function it appears in.)
*** Shell command terminated with exit status 1: gcc tst.c -o tst.o -g -c
-DC_NO_PIC_NO_DLL -I /home/dfaken/lib/chicken/include

I can't reproduce the error here (using 1.31 and MSVC on Windows), so I'm
not really sure why the compiler complains. But, basically two things have
to be kept in mind:

1) callback do indeed not capture the lexical environment (that should be
  explicitly stated in the manual, of course)
2) #> ... <# should only appear at toplevel (I will also update the manual
  accordingly)


cheers,
felix




reply via email to

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