[plt-scheme] Strange error in C bindings

From: Paul Steckler (steck at ccs.neu.edu)
Date: Tue Jan 21 14:31:59 EST 2003

>   (define connect
>     (opt-lambda (host user password db [port 0]
> [unix-socket #f] [client-flag 0])
>       (let ((mysql (make-MYSQL)))
>         (maybe-fail-mysql (mysql-init mysql))
>         (maybe-fail-mysql (mysql-real-connect mysql
> host user password db port unix-socket
> client-flag)))))
> 
> This seemingly equivalent definition raises an
> exception as it should:
> 
>   (define connect
>     (opt-lambda (host user password db [port 0]
> [unix-socket #f] [client-flag 0])
>       (let ((mysql (make-MYSQL)))
>         (maybe-fail-mysql (mysql-init mysql))
>         (mysql-real-connect mysql host user password
> db port unix-socket client-flag)
>         (maybe-fail-mysql mysql))))

Not quite equivalent, since the second call to maybe-fail-mysql is
applied to a returned value in the first case, and to mysql in the
second.  How do you know what that returned value is?

-- Paul




Posted on the users mailing list.