Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm not sure I agree with that. JSON parsing uses panic() and recover() for some logic. And templating is more of a PoC for coroutines in Go than a properly fleshed out library. Not to mention that the AST parsing for Go is horribly designed (though you can do some cool stuff with it).


> And templating is more of a PoC for coroutines in Go than a properly fleshed out library.

I worked with Rob on that library and that's really not the case. It was designed from the ground up to replace the existing template library which was bad in several ways. The parser (which is I think what you refer to) is just an implementation detail.


> I worked with Rob on that library and that's really not the case. It was designed from the ground up to replace the existing template library which was bad in several ways. The parser (which is I think what you refer to) is just an implementation detail.

Right, but why can't I call define custom operators? And why is there no bracketing in conditionals? It just feels clunky to me (but maybe I'm too spoiled with Jinja2). I still feel like you could allow execution of functions passed in the data argument (as long as the developer doesn't shoot themselves in the foot, it shouldn't be a security problem).

It's stuff like that which makes me feel like it was a PoC (or at least, not designed to be feature-complete). Still, it works pretty well for plenty of usecases (I use to generate config files every once in a while).


> I still feel like you could allow execution of functions passed in the data argument

I don't recally anyone asking for this before. File an issue? https://golang.org/issue/new

> It's stuff like that which makes me feel like it was a PoC (or at least, not designed to be feature-complete).

It's designed to be a useful template engine. I don't know about "feature complete", but we are still improving it. If you find it lacking then please file issues so that we can think about improving it.


I guess, the library authors needed to learn Go themselves as they build up the stdlib.


Even if you don't think the code itself is very nice, the API is pretty well-designed.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: