RFR: 8367531: Template Framework: use scopes and tokens instead of misbehaving immediate-return-queries [v29]

Roberto Castañeda Lozano rcastanedalo at openjdk.org
Fri Nov 14 14:44:54 UTC 2025


On Fri, 14 Nov 2025 14:25:45 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

> So I suppose it is a choice, yes. But I don't think the alternatives would be better.
> 
> * You could just throw an exception at the second definition. But then you would need a way to check for existence of hashtag names ... not great.
> * You could just hide outer definitions... basically they would work like scoped values: you can bind and re-bind them. But that brings its own complexity that I don't want to push on the users if it's not absolutely necessary.
> 
> If you really do need access to something from an outer template, you should just pass it via template argument. That makes the flow explicit. That's my opinion.

Sounds OK to me, I think it would be worth capturing this rationale and advisory somewhere in the documentation.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/27255#issuecomment-3533101399


More information about the hotspot-compiler-dev mailing list