On Thu, Aug 20, 2020 at 10:20:59AM +0000, user1234 via Digitalmars-d-announce 
wrote:
> On Thursday, 20 August 2020 at 10:12:22 UTC, aberba wrote:
> > Wrote something on OpenSource.com
> > 
> > https://opensource.com/article/20/8/nesting-d
> 
> I'm not sure. A few notes on nesting.
> 
> 1. context pointer can prevent inlining. you can nest static funcs,
> but then what is the point

The point is not to pollute module namespace with implementation details
that are only relevant to that one function.

Also, if you're worried about inlining, use LDC instead of DMD. LDC is
well able to inline nested functions.  Don't make judgments based on the
DMD backend; it's well-known that its optimizer is ... sub-optimal...


> 2. bad complexity. you can make the nested funcs static and factor
> them out.  The code is more readable.
[...]

The point is not to pollute module namespace with functions that are
only relevant as implementation details of one function.


T

-- 
First Rule of History: History doesn't repeat itself -- historians merely 
repeat each other.

Reply via email to