Things which may be of interest in Go v1.4

Katherine Cox-Buday katherine.cox-buday at canonical.com
Thu Dec 11 17:10:54 UTC 2014


On Thu, Dec 11, 2014 at 10:52 AM, Eric Snow <eric.snow at canonical.com> wrote:
>
> Cool.  So generics via macros?
>

Well, I intentionally didn't specify generics. Yes, that is a use-case. But
from what I gather, go generate is intended to be used once when first
writing code, not every time you compile.

So it's more like another tool than a language feature: you use the tool to
remove the tedium/errors from copy/pasting. So to continue the Set example,
if you were implementing a new type and you wanted to use it with Sets,
you'd reach for two tools: go generate, and a library which generates a Set
type specific to another type. It generates new source code which gives you
this functionality. It's much more intentful than generics in that you have
to make a decision to generate code.

 Also, while I think this will mostly be used to parse/generate Go code,
it's also not limited to that. Rob Pike gives yacc as an example of where
this might also be useful.


> Nice.  This would be good for our various testing sub-packages, among
> other things.
>

Good point, I hadn't thought of that.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/juju-dev/attachments/20141211/082dcd1f/attachment.html>


More information about the Juju-dev mailing list