Best practices

H. S. Teoh hsteoh at quickfur.ath.cx
Tue Aug 27 15:31:11 PDT 2013


On Wed, Aug 28, 2013 at 12:24:20AM +0200, JS wrote:
> On Tuesday, 27 August 2013 at 21:30:53 UTC, H. S. Teoh wrote:
[...]
> >One example of this is the recent implementation of templated
> >manifest constants. What *used* to be recommended practice is to
> >write:
> >
> >	template hasLength(T) {
> >		enum hasLength = is(typeof(T.init.length)) &&
> >				is(T.init.length : size_t);
> >	}
> >
> >But now, a new, nicer syntax is recommended:
> >
> >	enum hasLength(T) = is(typeof(T.init.length)) &&
> >				is(T.init.length : size_t);
> >
> >So if you were to ask what was "best practice" in 2.063.2, I'd
> >recommend the first form above. But once 2.064 is out, it would be
> >the second form.
> >
> 
> Such an "online book" could deal with versioning issues quite nicely.
> If a specialized book writing site isn't available then I'm sure a
> wiki would work.

http://wiki.dlang.org/

;-)

Seriously, though, the wiki could use someone who could dedicate some
love and care to it, to get it into a shape that's readily accessible
for newcomers. There's already a section devoted to D-related articles
and a tutorial section with a number of "best practices" articles, but
it's still rather bare and needs more content -- a *lot* more content.


T

-- 
Freedom: (n.) Man's self-given right to be enslaved by his own depravity.


More information about the Digitalmars-d mailing list