'!' and naming conventions
w0rp via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Jun 18 14:04:27 PDT 2014
On Wednesday, 18 June 2014 at 20:55:36 UTC, cym13 wrote:
> Hello,
>
> I see a lot of functions and other stuff with a '!' in the name
> such as 'bitfields!' or 'ctRegex!'. What does it mean exactly?
> In
> scheme, we use such a convention to warn that a function is not
> pure, but I don't see the point of using it that way in D as
> there are other way to express it.
>
> Moreover, I'm looking for a style guide of D, something like the
> PEP8 for python. Is there anything like that?
>
> Thanks!
! is actually the way in D of passing compile time arguments. So
take for example the 'to' function.
double foo = 3.14;
// Convert a double to a string.
string bar = foo.to!string;
// Same as the above, written a little differently.
bar = to!(string)(foo);
// How C++ and friends would write it.
// bar = to<string>(foo);
More information about the Digitalmars-d-learn
mailing list