You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am yet again making a new set of slides with nimislides (public soon) and as usual I try to innovate a bit my workflow.
For this feature request it is harder to make a title for this feature (and even harder to understand the title) than an example:
import nimib, nimislides
templateslide(ident: untyped, body: untyped) =template`slide ident`=
slide:
body
# I use this idiom currentlytemplateslideTitleAlt=
slide:
nbText: "## My title slide"# and this is sugar for this idiomslide(Title):
nbText: "## My title slide (but using a template)"whenisMainModule:
nbInit(theme = revealTheme)
setSlidesTheme(Serif)
# having slides called here makes it easier to add them and remove them while creating a presentation
slideTitle
slideTitleAlt
nbSave
the proposal is to introduce the template slide(ident: untyped, body: untyped) as above to allow the isMainModule workflow with reduced indentation. Ah in the example above I did not use it but I would probably export the template by default (since it can be used from different sets of slides).
The text was updated successfully, but these errors were encountered:
Hmm, can you come up with another name for the template than slide? Overloading of templates with untyped bodies is already a bit of a mess so would like to avoid that. Otherwise I like the idea 😄
I was bitten right after with problems with the overload! Agree that is scary but it should not be. At some point I would want to investigate all these issues with templates and try to find some minimal reproducible examples.
There isn't really anything to reproduce in these cases really. It is just the fact that the compiler needs to decide which overload to use. So if the first argument to a template can be either untyped or string for example, then it must type-check it to find out what it is. And if it isn't a string, well then it has already type-checked that code which could error if it is invalid.
There was a feature in Nim 1.6 that allowed optional parameters in templates before an untyped block. But it was moved behind an experimental switch in a later version because it caused weird behaviors.
I am yet again making a new set of slides with nimislides (public soon) and as usual I try to innovate a bit my workflow.
For this feature request it is harder to make a title for this feature (and even harder to understand the title) than an example:
the proposal is to introduce the
template slide(ident: untyped, body: untyped)
as above to allow the isMainModule workflow with reduced indentation. Ah in the example above I did not use it but I would probably export the template by default (since it can be used from different sets of slides).The text was updated successfully, but these errors were encountered: