golang-design/history

document the history of blank identifier to ignore values

Delta456 opened this issue · 4 comments

I think its necessary to know and research why _ was specifically chosen as the identifier to ignore values as Go was the first one to adopt it.

The blank identifier was introduced in golang/go@4e56b33.

The language spec states the reason why it was chosen:

The blank identifier provides a convenient way to ignore values returned by a multi-valued expression [...]

Go is not the first programming language that adopts it. I know the blank identifier way back from Python 2.6, giving the fact that Python 2.6 was released in 2008 and the change of Go was in 2009.

So I do not think the blank identifier could get into the repo as a fascinating history. This seems like a likely decline. Leave one week for comments.

But _ is a valid identifier in Python i.e. you can use and change it. Go and other languages who have it treat them very specially unlike others.

It's just a matter of choice. The semantics are similar.

If you'd like to object the argument, you need to present more concrete reasons such as how a blank identifier is as interesting as the go keyword.

No changes in consensus. Close.