On Thursday, 25 May 2017 at 03:10:04 UTC, Adam D. Ruppe wrote:
"Currently FunctionLiterals that capture their outer context
(i.e. closures/delegates) require an allocation and the garbage
collector. "
Not necessarily true, make sure you actually mention `scope
delegate` and `alias` params that do not return it. Those
capture but do not allocate.
It's an infant document, wording is out there somewhere...
"We will be proposing a syntax redundant w.r.t. current
behavior (i.e. capture by reference), so maybe we should
consider proposing deprecation?"
Don't do that.
Why not? I, personally, have a simple, but solid, justification:
Captures, if any, should be explicit. That is all :)
That is solely my opinion, hence the cautious "maybe"...
"Capture by reference"
I'm against that, no need adding it and it complicates the
whole thing. For example, "ref int _i;" as a struct member;
there's no such thing in D. (the compiler could do it but
still). And you'd have to explain the lifetime. Just no point
doing this, the current behavior is completely fine for this.
By inference, adding capture syntax at all will also complicate
the whole thing. IMHO, we either should have one, or the other,
but not both. P.S. have you seen the TODO at the bottom of that
section?