guile-user
[Top][All Lists]
Advanced

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

Problem with (eq? ...) and Serveez


From: Roland Besserer
Subject: Problem with (eq? ...) and Serveez
Date: 27 Jan 2004 16:30:32 -0800
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Hi,

I'm at a loss why the code below fails running in serveez
with guile (1.6.x and 1.4.x):

I have a serveez server implemented in guile. Serveez uses a 'sock'
object as an argument to certain callback functions. In one such
callback function I add the 'sock' argument to a list:

(define bcs '())

....

(define (callback-fn1 server sock)
        ...
        (set! bcs (cons sock bcs))
        ...
)

later, in another callback function, I want to remove the 'sock' object:

(define (callback-fn2 sock req len)
        ...
        (set! bcs (remove-if (lambda (x) (eq? x sock)) bcs))
        ...
)

remove-if fails because eq? always returns #f for the comparison case.
I tested eq? against a number of cases and got the following results:

(set! bcs sock)
(eq? bcs sock)  -->  #t
(display sock)  -->  #<svc-socket f1808>
(display bcs)   -->  #<svc-socket f1808>

(define bcs '())
(set! bcs (cons sock bcs))
(eq? sock (car bcs))       --> #f
(display sock)             --> #<svc-socket f1808>
(display (car bcs))        --> #<svc-socket f1808>


Why does eq? fail in the second case?
Any pointers would be welcome.

Regards

roland




reply via email to

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