proposal: all custom defined basic types should support composite literals #22677
Labels
FrozenDueToAge
LanguageChange
Suggested changes to the Go language
Proposal
v2
An incompatible library change
Milestone
Often, I change the kinds of some custom types in my custom packages between non-basic types and basic types, back and forth. For example, one custom type declaration:
There are many local variables of this type are used in other packages.
These variables are declared like
v := MyType{}
Later, I changed my mind to declare the type as
Now, all the variable uses are broken, for the error
invalid type for composite literal
.However, if basic types also support composite literals. Those uses will be still legal.
And the proposal will make Go syntax more consistent.
The text was updated successfully, but these errors were encountered: