[gambit-list] Bug (?) with BlackHole and append!

Yves Parès limestrael at gmail.com
Fri Aug 6 14:10:10 EDT 2010


Still with append!, I have another problem.
If my list is initially empty, append! does not alter it:

(define a (list))
(append! a (list 1 2 3))

And a remains empty... I don't know if it is normal

2010/8/6 Yves Parès <limestrael at gmail.com>

> Okay, thanks. I didn't knew that.
>
> Speaking about BlackHole, I was wondering: how could one define his own
> module resolver?
> For instance I saw that termite has a BH version. But I don't know how I
> could import it if I install it system-wide.
>
>
> 2010/8/6 Marc Feeley <feeley at iro.umontreal.ca>
>
> This is not a problem with blackhole.  Your program contains an error
>> because it is trying to mutate a constant.  In Scheme, quoted objects are
>> not mutable and it is an error to mutate them.  The interpreter does not
>> enforce this error because it implements constants using mutable objects.
>>  The compiler implements constants using "permanent objects" which cannot be
>> mutated (they are not scanned by the garbage collector).
>>
>> You could fix your program by doing
>>
>> (define a (list 3 2 4 2))
>>
>> instead of
>>
>> (define a '(3 2 4 2))
>>
>> Marc
>>
>> On 2010-08-06, at 9:26 AM, Yves Parès wrote:
>>
>> > Hello,
>> >
>> > I have a file "test.scm" containing the following lines:
>> >
>> > (import (std srfi/1))
>> >
>> > (define a '(3 2 4 2))
>> > (append! a '(8 8 8))
>> >
>> > (display a)
>> > (newline)
>> >
>> >
>> > When I lauch: gsc -e '(load "~~/lib/modules/build")' -
>> > and then (import test) it displays '(3 2 4 2 8 8 8)', which is fine.
>> > But if 'test' has been compiled first with (module-compile! 'test), then
>> when importing I got the error:
>> >
>> > *** ERROR IN ##main -- (Argument 1) MUTABLE object expected
>> > (set-cdr! '(2) '(8 8 8))
>> >
>> >
>> > (I use the last git version of BH)
>> > _______________________________________________
>> > Gambit-list mailing list
>> > Gambit-list at iro.umontreal.ca
>> > https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://webmail.iro.umontreal.ca/pipermail/gambit-list/attachments/20100806/26e7dada/attachment.html 


More information about the Gambit-list mailing list