Skip to content

Remove scope from opIndex #464

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

Closed
wants to merge 1 commit into from
Closed

Conversation

dkorpel
Copy link
Contributor

@dkorpel dkorpel commented May 2, 2023

Trying to unblock dlang/dmd#14236

These opIndex functions return _fun(this._iterator[index]); which can easily escape this, so best to let it be inferred based on template parameters.

@thewilsonator
Copy link
Contributor

please remove the whitespace changes.

@9il
Copy link
Member

9il commented May 3, 2023

That may be a breaking change.

@dkorpel dkorpel force-pushed the opindex-scope branch 2 times, most recently from f95a8bb to f2846ae Compare May 3, 2023 09:10
@dkorpel
Copy link
Contributor Author

dkorpel commented May 3, 2023

please remove the whitespace changes.

My editor did them automatically. I removed them now.

@9il
Copy link
Member

9il commented May 3, 2023

so best to let it be inferred based on template parameters

It isn't possible as far as I know. Walter didn't implement scope inference.

@dkorpel
Copy link
Contributor Author

dkorpel commented May 3, 2023

It isn't possible as far as I know. Walter didn't implement scope inference.

He did, though it's not very good admittedly

@9il
Copy link
Member

9il commented May 5, 2023

The code at dlang/dmd#14236 (comment) looks good to me. What is wrong there?

@dkorpel
Copy link
Contributor Author

dkorpel commented May 5, 2023

The function is marked scope, but it returns this.p, so it should be return scope.

@dkorpel
Copy link
Contributor Author

dkorpel commented May 5, 2023

However, since opIndex is inside a templated struct here, it should be able to infer return scope on top of scope. I guess I'll try to fix that on dmd's side.

@dkorpel dkorpel closed this May 5, 2023
@9il
Copy link
Member

9il commented May 5, 2023

However, since opIndex is inside a templated struct here, it should be able to infer return scope on top of scope. I guess I'll try to fix that on dmd's side.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants