Article: the feature that makes D my favorite programming language

H. S. Teoh hsteoh at quickfur.ath.cx
Fri Jul 24 21:19:28 UTC 2020


On Fri, Jul 24, 2020 at 08:34:17PM +0000, aberba via Digitalmars-d-announce wrote:
> Wrote something on the feature that makes D my favorite programming
> language
> 
> https://opensource.com/article/20/7/d-programming

Nitpick: evenNumbers doesn't need to return int[].  In fact, dropping
the .array makes it even better because it avoids an unnecessary
allocation when you're not going to store the array -- writeln is well
able to handle printing arbitrary ranges. Let the caller call .array
when he wishes the store the array; if it's transient, omitting .array
saves an allocation.


T

-- 
Nearly all men can stand adversity, but if you want to test a man's character, give him power. -- Abraham Lincoln


More information about the Digitalmars-d-announce mailing list