opDispatch forwarding and ifti

Stefan Koch via Digitalmars-d digitalmars-d at puremagic.com
Mon Feb 27 06:27:21 PST 2017


On Monday, 27 February 2017 at 13:17:21 UTC, John Colvin wrote:
> On Monday, 27 February 2017 at 12:22:02 UTC, Stefan Koch wrote:
>> On Monday, 27 February 2017 at 12:14:10 UTC, John Colvin wrote:
>>> Has anyone ever found a way to actually implement forwarding 
>>> properly with opDispatch, such that it works for both general 
>>> templates and also functions called using ifti (implicit 
>>> function template instantiation)?
>>>
>>
>> What is your actual usecase ?
>
> I'm trying to make std.typecons.Proxy support more things 
> correctly (e.g. template members, members that are aliases of 
> types). I thought that was clear from the rest of my post.
>
>> You are aware that your trying to mix an runtime and a 
>> compile-time feature, yes ?
>
> Not quite sure what you mean there. What is a runtime feature 
> here?
>
>> If it can be done then you will have to use CTFE and 
>> aliasSeqOf.
>
> The problem isn't with generating code (unless there's some 
> very involved exhaustive solution I haven't thought of). How 
> would you imagine I would use CTFE or aliasSeqOf to help here?

op-dispatch is a runtime feature.
It takes a string which is avilable at compile-time and passes it 
as a runtime parameter.
This runtime parameter can be used at ctfe if opDispatch is 
called at ctfe.
Then aliasSeqOf transforms it into a string-literal which can be 
used by templates.


More information about the Digitalmars-d mailing list