[plt-scheme] Parameters versus continuation marks

From: Dave Gurnell (d.j.gurnell at gmail.com)
Date: Mon Jan 14 08:59:14 EST 2008

Dear Schemers,

I'm trying to write some code to log database transactions. Here is a  
distilled example:

   File example.ss:

   1    (define (main)
   2      (call-with-transaction save-my-data))
   3
   4    ;; ( -> void )
   5    (define (save-my-data)
   6      (insert-into-database "a" "b" "c"))

I'd like to add some logging to insert-into-database, including some  
details about where call-with-transaction was called from. For  
example, for the code above I'd like insert-into-database to know that  
call-with-transaction was called from line 2, column 2 of example.ss.

I'm sure I need to convert call-with-transaction to a macro to get  
access to the position of the call site. However, I'm not sure of the  
"correct" way of passing the information to insert-into-database. It  
seems like I have at least two options: continuation marks and  
parameters, but I don't know the relative merits of which, or which I  
should choose in this type of situation.

Can anyone offer any advice (or information on the difference between  
the two)?

Thanks in advance,

-- Dave

PS - Transactions may be nested, and I'd like to log the position the  
outermost call-with-transaction.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20080114/36a55b44/attachment.html>

Posted on the users mailing list.