On Tue, 21 Feb 2017 01:16:08 -0800 (PST) "'pfitzsimons' via golang-nuts" <golang-nuts@googlegroups.com> wrote:
> The _ is used as the https://golang.org/ref/spec#Blank_identifier to > ignore right-hand side values in an assignment > (https://golang.org/ref/spec#Assignments) > > In VI(M) _ is used as a black hole register > http://vimdoc.sourceforge.net/htmldoc/change.html#registers when you > want to delete clipboard text > > Does the _ (blank identifier) in golang trace back to VI(M) _ (black > hole register) or was _ used before this to discard text? I think for the case of Vim's blackhole register, this is a coinsidence. Instead, _ is probably taken from many functional languages where it's used in so-called pattern matching [1] and stands to mean "discard the matching value on the right hand-side" of the expression. By the way, in many (most?) POSIX shells, the $_ variable means the last positional argument of the last command executed. And Perl (sort of obviously ;-)) has it, too. 1. https://en.wikipedia.org/wiki/Pattern_matching -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.