Mysteries of the Underscore
H. S. Teoh
hsteoh at quickfur.ath.cx
Mon Dec 24 17:05:25 UTC 2018
On Mon, Dec 24, 2018 at 04:53:57PM +0000, Neia Neutuladh via Digitalmars-d-learn wrote:
> On Mon, 24 Dec 2018 08:16:01 -0800, H. S. Teoh wrote:
> > Rather, it's *conventionally* taken to mean "unused". The language
> > actually does not treat it in any special way apart from "normal"
> > identifiers. It's perfectly valid (though probably not
> > recommended!) to declare functions or variables with the name "_"
> > and use them.
>
> I once, in my callow days, wrote a unittest with variables named _,
> __, ___, etc. It did not pass code review, but it did amuse.
GNU gettext used to (and perhaps still does?) use "_" as the name of the
macro to do l10n string lookups. I suppose the idea was brevity for
strings which are ubiquitously used, but still.
T
--
Тише едешь, дальше будешь.
More information about the Digitalmars-d-learn
mailing list