On 2014/02/09 18:53:49, adonovan wrote: > Generally looks good, but wait for gri's review. > ...
11 years, 11 months ago
(2014-02-09 20:10:49 UTC)
#6
On 2014/02/09 18:53:49, adonovan wrote:
> Generally looks good, but wait for gri's review.
>
> FYI: I didn't see the mail for this until today, even though I'm on the
> reviewers list. Was I a late addition, or is something else misconfigured?
You were both late additions. I started the CL as a proof-of-concept, then
later decided to mail it.
I'm going to have to think about this for a little while. The API is ...
11 years, 11 months ago
(2014-02-10 21:09:41 UTC)
#8
I'm going to have to think about this for a little while.
The API is already complicated, and I don't want to expose more. After
CheckExpr, the next thing will be CheckStmt, etc. - In fact, CheckStmt makes
more sense since it subsumes expressions and (local) declarations. It would also
enable "line-by-line" type checking.
That said, providing the correctly set up context requires extra care. As is,
this is only exposing machinery but not making it easy to use.
- gri
https://codereview.appspot.com/60110044/diff/100001/cmd/vet/types.go
File cmd/vet/types.go (right):
https://codereview.appspot.com/60110044/diff/100001/cmd/vet/types.go#newcode76
cmd/vet/types.go:76: // Create a file set that looks structurally identical to
the
We really don't want to expose this to clients, exactly for reasons like this.
types.New() is easy to use. types.CheckExpr is not.
Yes, CheckStmt would be great in theory, but is there a real need for it? ...
11 years, 10 months ago
(2014-02-18 12:59:49 UTC)
#9
Yes, CheckStmt would be great in theory, but is there a real need for it?
CheckExpr is definitely useful and it makes go/types complement go/parser.
Regarding ease of use: I've addressed the issue of the FileSet below; what
else? The Package, Scope, and Info parameters are straightforward.
https://codereview.appspot.com/60110044/diff/100001/cmd/vet/types.go
File cmd/vet/types.go (right):
https://codereview.appspot.com/60110044/diff/100001/cmd/vet/types.go#newcode76
cmd/vet/types.go:76: // Create a file set that looks structurally identical to
the
On 2014/02/10 21:09:42, gri wrote:
> We really don't want to expose this to clients, exactly for reasons like this.
> types.New() is easy to use. types.CheckExpr is not.
In some (most?) cases, clients will already have a token.FileSet and then
types.CheckExpr is not so bad.
As Alan pointed out, parser.ParseExpr really ought to accept a token.FileSet. I
don't think we should let this limitation of go/parser affect the API of
go/types. But to make it easier to use we should provide such a version of
parser.ParseExpr, if possible; or at least wrap up the following two lines in
something like astutil.FileSetForExpr and mention it in the doc for CheckExpr.
Issue 60110044: go.tools/go/types: Add Info parameter to EvalNode, remo...
Created 11 years, 11 months ago by gmk
Modified 11 years, 10 months ago
Reviewers: gri, adonovan
Base URL:
Comments: 21