3 Oct 10:35
Revisit synonyms and references / typing
edA-qa <edA-qa <at> disemia.com>
2004-10-03 08:35:33 GMT
2004-10-03 08:35:33 GMT
I would like to revist Slawek's example from before of the invoker series:
template<class T> void InvokerA( T^ fun )
{ fun.doSomething(); }
template<class T> void InvokerB( T^ fun )
{ InvokerA( fun ); }
...
T local;
T^ shared = new T();
InvokerB( local );
InvokerB( shared );
I believe this meets the requirements of no copying of the parameters
without needing a reference. Here's why, and it has to do with typing,
an issue that has been somewhat ignored.
In my previous statemtn about references and instances, I am of the
opinion, that in the way C2 works, the reference type has nothing to do
with the actual instance type. Therefore:
T local;
T^ sharedRef = new T();
T local^ localRef = @local;
T* ptr = /*something*/;
Unlike C/C++, in C2 all of the above references are used in the same
fashion:
local.func();
(Continue reading)
-Rajesh
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
RSS Feed