On 14.04.22 13:42, wjoe wrote:
Undefined behavior yes, but regardless the example proves it can be done
in @system code.
A few versions ago, possibly due to a bug or regression, the compiler
didn't complain in @safe code either.
Of course you are correct academically. However, since it's
On Tuesday, 12 April 2022 at 23:23:59 UTC, Ali Çehreli wrote:
[...]
Looking at this from a technical perspective - everything you say
is true - and thanks for clearing up some of my confusion in that
department.
Looking at this from a natural language (English) perspective -
words prompt
On Tuesday, 12 April 2022 at 22:23:18 UTC, ag0aep6g wrote:
On Tuesday, 12 April 2022 at 19:54:13 UTC, wjoe wrote:
Especially since it's only a promise and the compiler accepts
this:
void foo (const(char)[] arr)
{
cast(char[])arr[0..3] = "baz";
}
string bar = "123";
foo(bar);
On Thursday, 14 April 2022 at 08:55:25 UTC, Chris Katko wrote:
[...]
It appears the nested function's variable capture depends on
forward declaration (the right term?). Whereas, I was under the
impression most/all of D worked on a multiple pass compilation
so the order of declarations
On Thursday, 14 April 2022 at 08:55:25 UTC, Chris Katko wrote:
I imagine this is a really odd edge case but it's piqued my
interest.
Consider this:
```d
void main() {
void foo() { initRuntimeState(i); }
foo();
if(!modifyRutimeState()) return;
int i = getRandomValue();
i =
On Thursday, 14 April 2022 at 08:55:25 UTC, Chris Katko wrote:
Using DMD. v2.098-beta-2
Not sure if right terminology. But I just wrote a nested
function that uses a variable outside its body. The capture
(right term?) is obvious where the invocation is. However, I
have to move the
Using DMD. v2.098-beta-2
Not sure if right terminology. But I just wrote a nested function
that uses a variable outside its body. The capture (right term?)
is obvious where the invocation is. However, I have to move the
declaration of the variable to above the nested function for it
to