Skip to content

Instantly share code, notes, and snippets.

@mdempsky
Created November 27, 2020 02:03
Show Gist options
  • Save mdempsky/265d940f4982ee6e5d434533808c1ff6 to your computer and use it in GitHub Desktop.
Save mdempsky/265d940f4982ee6e5d434533808c1ff6 to your computer and use it in GitHub Desktop.
xgo ideas
Language features to prototype
unsafe.Add, unsafe.Slice
Allow anything to be convertible to boolean type (zero value maps to false; non-zero maps to true)
Generalize && and || to non-boolean types (TODO: find golang proposal for this)
Ternary operator ?: (golang.org/issue/33171, and others)
Safe navigation operator ?. (golang.org/issue/42847)
Making nil a universal zero value (golang.org/issue/35966)
- Allow T() as zero value for T? Or only allow nil to be explicitly converted to arbitrary types like T(nil)?
Make T(v) addressable (golang.org/issue/9097)
Composite literal type inference (golang.org/issue/12854)
Relaxed := operation (golang.org/issue/30318)
Explicit alignment control types (golang.org/issue/19057)
Type ellision from struct literals (golang.org/issue/21496)
Allow ... interpolation in variadic arguments and slice literals (golang.org/issue/18605)
Relaxed conversion rules (golang.org/issue/19778)
Assignment into map fields (golang.org/issue/3117)
Struct literal initialization of embedded fields (golang.org/issue/9859)
Backwards incompatible, but still worth considering (maybe as opt-in):
Change scoping of for-range loop variables (golang.org/issue/20733)
Maybe:
Lightweight function literal syntax (golang.org/issue/21498)
String interpolation (golang.org/issue/34174)
Checked integer overflow (e.g., golang.org/issue/30209, golang.org/issue/30613)
Operator overloading (e.g., golang.org/issue/27605)
User defined iterables (e.g., golang.org/issue/24282)
More Unicode stuff for identifiers (e.g., golang.org/issue/20706
Larger int types like int128 (golang.org/issue/9455)
Generalized constants; maybe at least array/struct values (golang.org/issue/6386)
Sum types via interface type lists (golang.org/issue/41716; probably wait until generics for parser support)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment