commit | 925a1c4075e6fa58ac0d40e21fde56aea9af3a52 | [log] [tgz] |
---|---|---|
author | Todd Wang <toddw@google.com> | Tue Apr 19 02:46:31 2016 -0700 |
committer | Todd Wang <toddw@google.com> | Tue Apr 19 18:10:20 2016 +0000 |
tree | 68bed5102e083e58f99733711be0d1cba62b0a92 | |
parent | 81ed871cc2759de7e996a851af76c09f4cd57ce2 [diff] |
Prepare to remove non-nil-any (aka top-level-any) from vdl.Value Our final goal is to remove non-nil any from vdl.Value. The idea is that vdl.Value already represents a statically-typed "any" value, and we shouldn't allow vdl.Value.Type to return any, unless the value is any(nil). In the short-term, we keep the representation and API of vdl.Value as-is, and let it distinguish between these cases: Value{Type: T, Rep: R} Value{Type: AnyType, Rep: Value{Type: T, Rep: R}} However we change ValueEqual to consider these two cases to be equal, to help us get closer to our final goal. That should allow our existing tests to pass, but no longer rely on distinguishing these cases. This should make it easier for us to move to our final world where vdl.Value doesn't represent non-nil any, and doesn't have an API for it either. In addition we add the AssignIndex and AssignField methods to vdl.Value. If vdl.Value doesn't represent non-nil-any, we'll need these methods to perform assignment of array and list elements, and to perform assignment of struct and union fields. The implementation of these methods still relies on the existing top-level-any representation. And we also clean-up the vdl.Value API, removing the *Value return argument from all of the Assign* methods. That was meant as a convenience, but is more confusing than it is helpful, especially in the new world. We also add a *Type argument to each of the *Value() helper functions, so that we can easily create both named and unnamed scalars. The net result of this group of CLs is that we should be able to start converting existing code (e.g. the compiler) over to use the new no-non-nil-any semantics. MultiPart: 1/2 Change-Id: I665fc94dbe90c0d53a33c55495c28ac706f9cdc5
This repository defines the Go APIs of Vanadium.