Some small style rules for D user code:
1) All variables and functions arguments should be
immutable/const (or enum), unless they have to mutate (or there
is some other problem in Phobos, in the D type system, or in your
other code).
2) The code should contain as few cast() as possible. [*]
On 08/05/2013 03:01 PM, bearophile wrote:
2) The code should contain as few cast() as possible. [*]
What about to!() ... ? Is it possible to gain the performance of cast() while
using to!() ... ?
4) for/foreach/while loops are not evil, but it's better to use map/filter/zip
where possible
On Monday, 5 August 2013 at 13:01:19 UTC, bearophile wrote:
Some small style rules for D user code:
1) All variables and functions arguments should be
immutable/const (or enum), unless they have to mutate (or there
is some other problem in Phobos, in the D type system, or in
your other
I made a markdown gist for the above module import tips:
https://gist.github.com/nikibobi/6156492
On Mon, Aug 05, 2013 at 03:01:18PM +0200, bearophile wrote:
Some small style rules for D user code:
[...]
Note that in git HEAD, importing of packages as modules has been
implemented via package.d:
import my.path.module;
will now also work with:
/my
/my/path
On Monday, August 05, 2013 15:46:13 Joseph Rushton Wakeling wrote:
On 08/05/2013 03:01 PM, bearophile wrote:
2) The code should contain as few cast() as possible. [*]
What about to!() ... ? Is it possible to gain the performance of cast()
while using to!() ... ?
That depends. In general,