Reference counted containers prototype
    Robert Jacques 
    sandford at jhu.edu
       
    Tue Dec 27 22:59:31 PST 2011
    
    
  
On Tue, 27 Dec 2011 07:10:14 -0800, Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org> wrote:
> On 12/27/11 4:32 AM, Peter Alexander wrote:
>> On 27/12/11 3:05 AM, Andrei Alexandrescu wrote:
>>> On 12/26/11 8:23 PM, Peter Alexander wrote:
>>>> I am
>>>> not convinced that it can be used seamlessly without some relatively
>>>> large changes to the language.
>>>
>>> I repeat that opDispatch and auto ref were invented for this, so
>>> anything that doesn't work now is a bug. There are no changes needed to
>>> the language, only fix the bugs :o).
>>
>> How do you call template member functions of the held object without
>> changing opDispatch?
>
> The idea is to pass the entire template instantiation as the string.
>
> obj.foo!(bar, baz)(a, b);
>
> ->
>
> obj.opDispatch!("foo!(bar, baz)")(a, b);
>
>
>
> Andrei
>
I would have thought that the template parameters would be passed to opDispatch i.e.
obj.opDispatch!("foo",bar,baz)(a,b);
although I don't know how opDispatch would be written to handle such a call in a generic manner, i.e. I would want to define it as
obj.opDispatch!(string name, Targs..,Vargs..)(Vargs args) { ... }
but stuff like that isn't possible currently.
That said, parsing the string for "bar" and "baz" is both difficult and doesn't provide access inside opDispatch to "bar" and "baz".
    
    
More information about the Digitalmars-d
mailing list