<div dir="ltr">Something like<div><br></div><div>(define abcproperty-accessor (native-lambda (native-object) int "___result = ___arg1.abcproperty;"))</div><div><br></div><div><br></div><div>(define o (new Object))</div><div><br></div><div>(define abcproperty (abcproperty-accessor o))</div><div><br></div><div>?</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-12-08 0:44 GMT+08:00 ben yakawp <span dir="ltr"><<a href="mailto:ben.lists@yakawp.com" target="_blank">ben.lists@yakawp.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Just to be a little more precise. Expressing OO style in Scheme was not<br>
my primary concern here. The problem I see is that the all of the host<br>
languages (except the original C backend) access their library functions<br>
through an OO interface. It's not like the library approach in scheme<br>
were you can directly use a function after you imported it.<br>
<br>
That means if you want to use a function from a host language you first<br>
have to create an object. But now what is this object in Scheme and what<br>
can it do? In the best case, it would check the member calls at compile<br>
time. In the worst case it add runtime cost in the backend.<br>
<br>
But thats just stuff I was thinking about.<br>
<br>
What I wanted to know in the first place is how I should accessing<br>
backing library functions / ffing that are "hidden" behind OO apis.<br>
How is this done?<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
On Mon, Dec 7, 2015, at 05:13 PM, Marc Feeley wrote:<br>
> At the Scheme level, you can express the OO style in various ways.  Here<br>
> are 2 that come to mind:<br>
><br>
> 1) Your “new” operator could return a closure which receives as a first<br>
> parameter the name of the method to be called.  So you could:<br>
><br>
> (define o (new Lib))<br>
> (o print: "hello")<br>
><br>
> or<br>
><br>
> (define .print '.print)<br>
> (o .print "hello")<br>
><br>
> 2) You could make .print a function that receives as a first parameter<br>
> the object on which the method applies.  For example:<br>
><br>
> (define .print (lambda (self text) …))<br>
> (define o (new Lib))<br>
> (.print o "hello")<br>
><br>
> You can of course use macros to automate these styles.<br>
><br>
> Marc<br>
><br>
> > On Dec 7, 2015, at 8:31 AM, ben yakawp <<a href="mailto:ben.lists@yakawp.com">ben.lists@yakawp.com</a>> wrote:<br>
> ><br>
> > hi<br>
> > Sorry if this too obvious, but I don't understand how gambit handles<br>
> > objects from the hosts backend.<br>
> ><br>
> ><br>
> > For example: if one would like to construct a 'Node' library for the JS<br>
> > backend, how would you do that? The whole node api seems to be object<br>
> > oriented.  But also the Python standard libaries (batteries) are layed<br>
> > out class based. You had to do something like<br>
> ><br>
> > (define o (new Lib))<br>
> > (o.print "hello")<br>
> ><br>
> > This looks wrong. What am I missing?<br>
> ><br>
> > Regards<br>
> > ben<br>
> > _______________________________________________<br>
> > Gambit-list mailing list<br>
> > <a href="mailto:Gambit-list@iro.umontreal.ca">Gambit-list@iro.umontreal.ca</a><br>
> > <a href="https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list" rel="noreferrer" target="_blank">https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list</a><br>
><br>
_______________________________________________<br>
Gambit-list mailing list<br>
<a href="mailto:Gambit-list@iro.umontreal.ca">Gambit-list@iro.umontreal.ca</a><br>
<a href="https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list" rel="noreferrer" target="_blank">https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list</a><br>
</div></div></blockquote></div><br></div>