-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Closed
Labels
FrozenDueToAgeLanguageChangeSuggested changes to the Go languageSuggested changes to the Go languageProposalProposal-FinalCommentPeriodv2An incompatible library changeAn incompatible library change
Milestone
Description
Motivation
Go 1 is tightly designed with 25 keywords:
// dependency management
package import
// values
const var
// flow controls
if else break continue
switch case default
for range
goto fallthrough
// function calls
func return defer
// data structures
type struct map interface
// concurrencies
go chan select
All keywords have their value and orthogonal except the map which dedicated to a hash table data structure but also share similarities array and slice, according to the language specification:
ArrayType = "[" ArrayLength "]" ElementType .
SliceType = "[" "]" ElementType .
MapType = "map" "[" KeyType "]" ElementType .
Comparing to these three definitions, map prefix is redundant because "[" XXX "]" ElementType . is rich enough to represent various meanings depends on the difference of XXX.
Proposal
I propose to remove map from keywords, where a Go 2 map type is:
Go2MapType = "[" KeyType "]" ElementType .
Compatability
go fix can walk the whole program and drop all parsed map keyword from the program.
maj-odavecheney, OneOfOne, paalgyula, lbx-ai, deanveloper and 22 more
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeLanguageChangeSuggested changes to the Go languageSuggested changes to the Go languageProposalProposal-FinalCommentPeriodv2An incompatible library changeAn incompatible library change