I see, interesting, thanks for that. Note, those are different problems.
One is about trying to cheaply speed up template execution by //, I still wonder if that can be worthy, i foresee with the future translation package it might because of the additional call costs, but you know side effects, allocations, contentions... stuff like that.. and you are back to (unfinished...) alternatives ;) The second is about handling data injection into the template. Where i do have several critics too, I d simply won t put my services in a kv[string]interface{}, better to use another language if that is the final solution. To compare with context, at least context is a kv[interface{}]interface{}, which you can take advantage to be protective. On large scale, this approach is difficult to manage. ____________________________________________ Anyways some extended thoughts. For that specific case it happens i m working on what might be a solution, like the article you presented it does code introspection so the computer does the *** job for us. I use typed struct to do data injection, of services type TemplateData struct { SvcWhatever ServiceTypeToLookupFor } of other view components services type TemplateData struct { ViewWhatever ViewTypeToLookupFor } so far it seems to be perfect fit to rely on the type system rather than raw text. Then i do some preprocessing (rather than reflect) to bind that automatically. With more help from the computer i also decoupled the transport controller and the view controllerS, so i ll never have this stupid global head context to manage every details of the page to be generated. views won t be that stupid dead code anymore, it will manage its input to produce the desired output. So everyone is more autonomous on his task assignment and the code is generally more localized which looks better to me. Last, i d really like the same article techniques applied to translation management. The translation are always sparse across the application, every time its a pain to handle, either way, by declare ahead and use in the template, or use in template than declare in the translations. I d rather have a consume first approach with the help of a tool that inspects the templates for translation call, and process them to dedicated dictionaries to answer several useful questions, howto Insert translation of ID I for language N? Where is that translation ID used in the application? Does this translation requires plural support in the app ? Prepare the file to update/create the translations? etc etc On Thursday, June 1, 2017 at 8:05:16 AM UTC+2, Michael Brown wrote: > > I posted on another thread today one solution for this (Subj: "How to > parallelize text/template long-running functions") > > I got something simple working using a two-pass template execution, and > somebody else pointed me to > https://blog.gopheracademy.com/advent-2014/soy-programmable-templates/ > (which I haven't yet examined). > -- > Michael > > On Tuesday, May 30, 2017 at 3:09:35 AM UTC-5, mhh...@gmail.com wrote: >> >> hi, >> >> wonder, if anyone, >> - tried to make an implementation of template that works in // ? >> - was it successful ? >> - useful for perf ? >> >> thanks >> > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.