suppose I have:
int foo;
bar(&foo); <-- I want to duplicate this function call
suppose now, I have foo and bar in scheme land; how do I make the above function call? grepping for "&" in gambit-c.txt brings up the #& box syntax, but I don't think that's what I want
thanks!
Afficher les réponses par date
Date: Sun, 15 Feb 2009 00:45:46 -0800 From: lowly coder lowlycoder@huoyanjinjing.com
suppose I have:
int foo;
bar(&foo); <-- I want to duplicate this function call
suppose now, I have foo and bar in scheme land; how do I make the above function call? grepping for "&" in gambit-c.txt brings up the #& box syntax, but I don't think that's what I want
The locations of variables are not first-class objects. The language does not support directly reifying them like C can. If you have built a location abstraction, say
(define-record-type <location> (make-location reader writer) location? (reader location.reader) (writer location.writer))
(define (location-value location) ((location.reader location))) (define (set-location-value! location value) ((location.writer location) value)),
then you can reify the location of a variable <v> with
(make-locative (lambda () <v>) (lambda (value) (set! <v> value))).
On the other hand, your program would probably be clearer if you just used boxes to begin with.