[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
A C++ glue example
- To: self-interest@myself.stanford.edu (Self mailing list)
- Subject: A C++ glue example
- From: hernan@cc.gatech.edu (Hernan Astudillo R.)
- Date: Fri, 12 Feb 93 19:02:46 EST
- Resent-date: Fri, 12 Feb 93 16:05:53 PST
- Resent-from: Urs Hoelzle <urs@otis>
- Resent-message-id: <9302130005.AA01132@otis.Stanford.Edu>
- Resent-to: real-self-interest
dear list,
I recently had the opportunity to use the Self glue for C++, and
(after some initial bumping) I got to it ok. part of the solution is to use
a newer version of the primitiveMaker, which mercifully Bay sent me.
the use of proxies for C++ glue is not too clear from the manual, but
fortunately it is easy to understand by looking at the stubs generated by the
primitiveMaker. in fact, the altogether different approaches to object
creation in C++ and Self make for some interesting issues. I found myself
trying to fit C++ construction (by secondary effects of global functions)
into Self creation (by cloning of prototypes). this made me think for a
while, consider some alternative ways of representing sub-classes (since my
proxies are pseudo-sub-classes of "proxy"), and pick one based on
representation of sub-classing with composition rather than
copying+modification or asignment to "this".
anyway, i have included in the very next mail, the text of a complete
example of using Self glue to access C++ cons/destructors and members. the
code is liberally commented (methinks), and I considered and left (commented
out) several solutions to the above mentioned creation mismatch problem. I
think that may be useful for trying to define some standard "style". to make
the example useful, I also included a small C++ source file with the class to
be glued, the Self glue template, and the Self source for the proxy functions
(which use the glue).
greetings, and happy delegation!!
--hernan
--
-- |
Hernan Astudillo R. | "Life is short. Play hard."
hernan@cc.gatech.edu | -- Reebok
College of Computing, Georgia Tech, Atlanta GA 30332 / (404) 853-9390