Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] DIP63 : operator overloading for raw templates #3758

Closed
wants to merge 2 commits into from
Closed

[WIP] DIP63 : operator overloading for raw templates #3758

wants to merge 2 commits into from

Conversation

mihails-strasuns
Copy link

http://wiki.dlang.org/DIP63

After countless trial & error cycles I got most basic version that works for opIndex + opDollar. However my DMD hacking skills are horrible and before cleaning everything and adding more operator support I'd love to read some feedback if the way it is implemented is acceptable.

Please do not pay attention to all the debug stuff, just how it fits DMD architecture in general.
@9rnsr your feedback is most appreciated.

@WalterBright this DIP still needs your approval / rejection

template Pack(T...)
{
    alias opIndex(size_t index) = T[index];
    enum opDollar = T.length;
}

alias element1 = Pack!(int, double)[1]; 
alias element2 = Pack!(int, double)[$-1];

pragma(msg, element1);
pragma(msg, element2);

@mihails-strasuns
Copy link
Author

What I am concerned most about is that this DIP introduces new interpretation of template instances and I don't know if this needs to be represented as new distinct AST type.

@ghost ghost added the Enhancement label Aug 4, 2014
@mihails-strasuns
Copy link
Author

While initial experiments proved promising I have not found any way to implement opSlice support without major changes to internal AST structure. Going to close this for now as I only can pay attention to low hanging fruits.

ibuclaw pushed a commit to ibuclaw/dmd that referenced this pull request Jul 10, 2022
`core.memory`: Make GC.[profile]stats safe/nothrow/nogc

Signed-off-by: Rainer Schuetze <rainers@users.noreply.github.com>
Signed-off-by: Vladimir Panteleev <CyberShadow@users.noreply.github.com>
Signed-off-by: Max Haughton <maxhaton@users.noreply.github.com>
Merged-on-behalf-of: Max Haughton <maxhaton@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant