foreach

monarch_dodra via Digitalmars-d digitalmars-d at puremagic.com
Fri Jun 13 08:34:17 PDT 2014


On Friday, 13 June 2014 at 15:18:52 UTC, Nick Treleaven wrote:
> On 12/06/2014 16:57, simendsjo wrote:
>> Does any sane person use _ as a variable identifier and
>> then reference it?
>
> I forgot that C gettext has a macro called _(), and this D 
> version also has it (which is available via dub):
>
> https://github.com/NCrashed/dtext/blob/master/source/dtext.d#L115
>
> string getdtext(string s, string locale = ""){...}
>
> /// Short name for getdtext
> alias getdtext _;
>
> ...
> writeln(_("Hello, world!"));

C++ also recently defined some std::placeholders, which are _1, 
_2 through _N.


More information about the Digitalmars-d mailing list