<HTML><BODY>> Why not just define a new version of object-a that does that?<br><br>(set! object-a <br> (let ([old object-a])<br> (lambda (x) <br> (if (reference? x) <br> (ref-get old x)<br> (old x)))))<br><br>Like that for every accessor? + prop:impersonator-of... Maybe shall work.<br><br><br>Fri, 15 Aug 2014 08:45:59 -0400 от "Alexander D. Knauth" <alexander@knauth.org>:<br>
<blockquote style="border-left:1px solid #0857A6; margin:10px; padding:0 0 0 10px;">
<div id="">
<div class="js-helper js-readmsg-msg">
<style type="text/css"></style>
<div>
<base target="_self" href="https://e.mail.ru/">
<div id="style_14081067690000000643_BODY"><br>
Why not just define a new version of object-a that does that?<br>
You probably have a good reason, but what is it? <br>
Is it to change the result of struct->vector, allow (object a b c) as a match pattern to match ref, or what? <br>
<br>
On Aug 15, 2014, at 6:42 AM, Roman Klochkov <<a href="/compose?To=kalimehtar@mail.ru">kalimehtar@mail.ru</a>> wrote:<br>
<br>
> I have<br>
> (struct object (a b c))<br>
> (struct reference (id data))<br>
> <br>
> Let `ref' -- an instance of `reference'.<br>
> <br>
> I want, that (object-a ref) call my own (ref-get object-a ref)<br>
> <br>
> (define (ref-get accessor ref)<br>
> (unless (weak-box-value (ref-data ref))<br>
> (set-ref-data! ref (make-weak-box (load-data (ref-id ref)))))<br>
> (accessor (weak-box-value (ref-data ref))))<br>
> <br>
> Is it possible? <br>
> I found `impersonate-struct', but it is not struct itself (no `id' field). <br>
> I can add `prop:impersonator-of',. but how to redirect accessors?<br>
> <br>
> -- <br>
> Roman Klochkov<br>
> ____________________<br>
> Racket Users list:<br>
> <a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
<br>
</div>
<base target="_self" href="https://e.mail.ru/">
</div>
</div>
</div>
</blockquote>
<br>
<br>-- <br>Roman Klochkov<br></BODY></HTML>