News for hackers. Stuff that matters.
Re:Hero – A handy, fast and powerful Go template engine by tiborsaas on Tuesday February 14, 2017 @03:48AM (#13642198)
It shouldn't be. I prefer template engines that I like the syntax and documentation the most.

For low traffic efficacy doesn't matter, for high traffic you should always cache the templates.

Re:Hero – A handy, fast and powerful Go template engine by asitdhal on Tuesday February 14, 2017 @04:52AM (#13642431)
Exactly, I used django and jinja templates. Those two are feature rich. Golang template engine is mostly minimal with enough feature to do things.

The problem with Golang, most developers look for performance instead of the features. People who use python or ruby look for better features and ease of development. So, Golang engineers develop applications and libraries which doesn't help anyone.

Re:Hero – A handy, fast and powerful Go template engine by camus2 on Tuesday February 14, 2017 @05:51AM (#13642620)
Go template language has a nice context sensitive escape mechanism. But the syntax is kind of garbage and it's very limited when it comes to features ( no template inheritance, curb-some API for plugins ... ). Like everything in Go it gets you 50% there and but it's PITA to do something complex with it. Go is really bait+switch . You can get started fast but then you run into a vast amount of issues when it's time to deliver a professional product with std lib. It's true for testing,logging,writing web-apps, debugging and even concurrency. I hope the more Google rely on it, the more the maintainers will be pressured withing Google to fix its shortcomings.
Re:Hero – A handy, fast and powerful Go template engine by Zach_the_Lizard on Tuesday February 14, 2017 @07:01AM (#13642911)
Can't help but agree.

I write Go professionally now and it's just not a productive language. The concepts are there, but the execution was frankly quite lazy and inconsistent.

Never panic in an external API, but closing closed channels and random number functions panic in the same way Java throws checked exceptions.

Generics aren't important, except for slices, maps, and channels which are generic.

Really minor things like this add up

Re:Hero – A handy, fast and powerful Go template engine by icholy on Tuesday February 14, 2017 @09:21AM (#13643627)
When a program panics, it's saying that there is a fundamental problem with your logic. Closing closed channels and dividing by zero are both examples of those.
Re:Hero – A handy, fast and powerful Go template engine by sheeshkebab on Tuesday February 14, 2017 @08:29AM (#13643335)
Complex json parsing is kind of bad too in go - and rather surprising for a modern vm/go based language. (I guess they really tried to go for c/c++ with go but why vm/gc)

Google will probably fix these things with time though, or so I hope - at the moment go seems like a conflicted language.

Re:Hero – A handy, fast and powerful Go template engine by junke on Tuesday February 14, 2017 @04:19AM (#13642313)
Ideally, a template should be compiled into native code.
Re:Hero – A handy, fast and powerful Go template engine by masklinn on Tuesday February 14, 2017 @04:28AM (#13642348)
Not necessarily.

1. that requires parsing the template at compile-time (making it non-overridable at runtime) or the ability to generate executable code at runtime which break in NX-mandatory environment (e.g. appstore applications)

2. the runtime version may be much faster than the compile-time one, e.g. the rust Regex crate has both a runtime Regex structure and a regex! compiler plugin, the latter is currently significantly slower at runtime: https://github.com/rust-lang/regex#usage-regex-compiler-plug...

Re:Hero – A handy, fast and powerful Go template engine by junke on Tuesday February 14, 2017 @06:23AM (#13642745)
Yes, "compile/load/execute" can take longer than simply "eval". You have to consider amortized costs: how often do you need to recompile your template (or your regex)? Likewise, are you really going to override the template at runtime or is the variable part of the template already compiled as branches in the resulting code? Whatever needs to be dynamic can be dynamic while compiling as much as possible ahead of time.
Re:Hero – A handy, fast and powerful Go template engine by micmus on Tuesday February 14, 2017 @09:10AM (#13643559)
Elixir's EEx templating engine compiles templates into plain elixir functions, which makes the templates really fast.
Re:Hero – A handy, fast and powerful Go template engine by Zoadian on Tuesday February 14, 2017 @04:43AM (#13642398)
There is a web framework (vibed.org) written in the D programming language that does compile templates to native code.