4 ms·
The negative is that some issues are really hard to fix, because you don’t want to break the backwards compatibility guarantee. For example, there is a bug in
by shp0ngle 5y ago
The negative is that some issues are really hard to fix, because you don’t want to break the backwards compatibility guarantee.
For example, there is a bug in go’s built-in HTML templating, that it misrepresent javascript backticks.
If you do
<script>
var string = `http://google.com http://google.com`
</script>
in HTML template, it will interpret // as a comment and return
<script>var string = `http:</script>
This is now really hard to fix; it means either rewriting the JS parser from scratch, but that is a giant change (currently the JS parser is really simple, backticks are hard to do properly without reimplementing all from scratch); the more reasonable choice would be to just ban backticks in HTML templates, but that would break backward compat.
So there is basically an unfixable bug sitting in go html templates.
https://github.com/golang/go/issues/9200 https://github.com/golang/go/issues/9200
- rytill 5y agoIf it’s bad enough, why not release a v2 of the library?
- jen20 5y agoThe standard library seems to only be versioned with the language. An external v2 could work, but I’m not sure there’s any precedent for a v2 of a standard library package.
- theli0nheart 5y ago> I’m not sure there’s any precedent for a v2 of a standard library package. urllib/urllib2 in Python is one example. There are others; it's not really unprecedented.
- arp242 5y agoThere is no precedent in Go. It's been discussed a few times here and there, but real plans AFAIK.
- diogenesjunior 5y agoWhy can't they just make a new version of the library for fixes?
- badsectoracula 5y agoCan't they add an option or something that specifies how backticks are handled with the default setting to be the current (so nothing breaks) and any new code or existing code that knows about the issue can set it to a better value?
- eyelidlessness 5y ago> the more reasonable choice would be to just ban backticks in HTML templates, but that would break backward compat. Given script tags are allowed, this seems like the least reasonable choice. What other arbitrary JS features should be disallowed because the parser isn’t spec compliant?