Conversation
There was a problem hiding this comment.
Stef's suggestion looks very similar to the proposed nested helper syntax :-/
There was a problem hiding this comment.
@stefanpenner one of the goals of the proposal is to allow the user to overwrite a portion of the default layout. Does what you're suggesting allow for this?
There was a problem hiding this comment.
Stef's suggestion looks very similar to the proposed nested helper syntax :-/
yes, i would like to unify these two things.
There was a problem hiding this comment.
@stefanpenner this is a different use case and a different RFC, yielded helpers are about the block placing the content. Named templates are about the parent controlling the rendering via its layout. We need to keep these things separate.
|
Stef's syntax is easier to follow in terms of 'where is this coming from'. The ^ strikes me as trying to save keystrokes, but at the cost of clarity. Explicit data/control flow is better when reading the template IMO. |
|
@technomage |
|
I strongly favor the block params solution over named blocks, for all the reason @stefanpenner mentioned. I disagree that it handles a different case. Yielded helpers are general enough that users can actually implement their own named blocks when they need that: |
|
@ef4 can you please describe how your code example works or what it does? or show how |
|
In my example, the user is overriding default blocks in the parent's layout, just like in the RFC. I'll pick apart a slightly different example, because I think I can make the syntax even nicer: Once you have the ability to yield and pass helpers (or components, which is not so different), you don't need any other special support from the framework, and can do all of the rest in normal components. Which means less syntax for people to learn. One possible example for the parent's template would be:
So putting it all together, this example would output: <div class="this-is-the-parent">
My customized header
...other parent layout stuff...
Hello world
...other parent layout stuff...
Default footer content goes here
</div>because the header has been overridden by the child, and the footer has not. |
|
@ef4 customize helper does not get executed unless you yield, this is ignoring the scoping and execution rules of htmlbars and glimmer. You'd have to hack around a ton of stuff in order to get this to work. |
|
There is another strategy I think we could take that still plays well with scoping rules that could solve both problems that I'm going to try to convince @mmun to help me out making the RFC since I'm not very good at writing this stuff up, but I also think is easier to do via html tags. |
|
Can you transfer this into an issue so that we can continue to iterate on the right way forward? We have had a few discussions on this topic at the most recent face to face, and might have a path forward to achieve the intent. |
|
What would you like me to copy into issue? |
|
I just came across what I think is a good use-case for this. It doesn't seem to be exactly covered by the discussion above, but it's quite close. |
|
@jamesarosen that case can already be done pretty elegantly with the The template of the |
|
@ef4 :) |
RFC
Ideas are @krisselden's, I wrote it up to open the discussion.