On Wed, Jan 27, 2021 at 1:10 PM clément auger <
clement...@gmail.com> wrote:
>
> I am wondering if some backward compatibility is planned for programs heavily relying
> on ast, parser, type, packages packages to analyze, interpret, manipulate go source code.
>
> I read this morning the blog and it says
> 'The language changes are fully backward compatible' in its last news on this topic,
> does it apply to this case ?
>
> I am wondering the same question about the reflect package.
> I wonder at which extent it will have to be modified to welcome this new feature.
>
> I am asking those questions partly because i hope I will be able to transition without work, tbh, though maybe it wont be possible ?
To be clear, there is no Go 2, and there are no plans for Go 2.
I assume you are referring to adding generics to the language. If
that proposal is adopted, then necessarily the go/ast and related
packages will have to change. The changes will only be additions, and
those additions will only be used if working with a program that uses
type parameters. This means that some programs that manipulate Go
code will have to change to support manipulating Go code with
generics. And some programs will continue to work unchanged. The
same is true for any language change, but of course generics touches
many more parts of the language.
The reflect package is largely unaffected by the generics proposal.
See
https://go.googlesource.com/proposal/+/refs/heads/master/design/go2draft-type-parameters.md#reflection.
> In any cases, can I already read the new implementation somewhere or is it too soon ?
You can see preliminary versions of the changes to go/ast and related
packages on the dev.typeparams branch of the main Go repo. That is a
development branch being used to try out generics before the proposal
is accepted (if the proposal is accepted). As a development branch it
is not covered by any sort of stability guarantee and can change at
any time.
Ian