Skip to content

Conversation

9rnsr
Copy link
Contributor

@9rnsr 9rnsr commented Jan 23, 2014

From the discussion in issue 11946, I felt necessity of clear documentation about "Nested Templates" feature.

Note that, this is not a new feature from 2.065. it has been existed from early D2 age, although it was not well documented.

@CyberShadow
Copy link
Member

Are you sure this belongs in the language specification? If it is a limitation of the current implementation, it should be clearly noted that these restrictions will go away in the future.

@9rnsr
Copy link
Contributor Author

9rnsr commented Jan 24, 2014

@CyberShadow To explain about language/implementation limitation is much better than nothing is written. I'm placed the description under the "Limitation" section.

On the other hand, I don't know the limitation can be surely resolved in the future. See issue 5710 for the detailed discussion.

@CyberShadow
Copy link
Member

I'm placed the description under the "Limitation" section.

Sorry, didn't see that. Thanks.

On the other hand, I don't know the limitation can be surely resolved in the future. See issue 5710 for the detailed discussion.

Thanks, that was insightful. But I do not see any conceptual problems:

  • The issues I brought up dealt with alias parameters, not delegates. As it has been suggested in that discussion, for now the issue can be solved just for alias parameters, leaving multi-context delegates alone.
  • Regarding multi-context delegates, I agree with the last two comments in the discussion.

@9rnsr
Copy link
Contributor Author

9rnsr commented Jan 24, 2014

The issues I brought up dealt with alias parameters, not delegates. As it has been suggested in that discussion, for now the issue can be solved just for alias parameters, leaving multi-context delegates alone.

Current ABI specification describes that member functions and nested functions are called by exactly same call convention, and it is strongly tied to the delegate object memory layout. That is why fixing alias parameter issue will change the delegate memory layout.

@CyberShadow
Copy link
Member

Sorry if I wasn't clear - I meant to delay solving the problem of taking the address of a function with multiple context pointers. Calling the function directly can use any calling convention that the implementation wants. This will also be an opportunity to improve the error message: e.g. when you try to take the address of such a function, the compiler could say:

'S.f!(T.a)' needs 2 context pointers to 'S', 'T' - multi-context delegates are not implemented

BTW, in the original issue I brought up the function was getting called in CTFE, so there it's not even a question of codegen, just semantics.

@MartinNowak
Copy link
Member

LGTM, please rebase

@MartinNowak MartinNowak closed this Mar 1, 2014
@CyberShadow
Copy link
Member

Why close the pull though?

@MartinNowak
Copy link
Member

Why close the pull though?

I didn't mean to.

@MartinNowak MartinNowak reopened this Mar 2, 2014
----
)

$(P In above, $(D Foo!().foo) will work just same as member function
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/In above/above/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/just same as member/just the same as a member/

@andralex
Copy link
Member

otherwise lgtm at least for now

@9rnsr
Copy link
Contributor Author

9rnsr commented Mar 16, 2014

Thanks for many corrections. Updated.

andralex added a commit that referenced this pull request Mar 16, 2014
Add documentation about "Nested template" feature.
@andralex andralex merged commit d8b3593 into dlang:master Mar 16, 2014
@9rnsr
Copy link
Contributor Author

9rnsr commented Mar 16, 2014

Thanks!

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.

4 participants