On Thursday, 3 July 2025 at 15:29:53 UTC, Nick Treleaven wrote:
On Monday, 30 June 2025 at 04:51:58 UTC, Rajesh wrote:
On Sunday, 29 June 2025 at 21:56:19 UTC, 0xEAB wrote:
On Sunday, 29 June 2025 at 13:06:38 UTC, Rajesh wrote:
Is there a restriction that I cannot call **return** from
foreach
On Monday, 30 June 2025 at 14:30:49 UTC, Manfred Nowak wrote:
On Sunday, 29 June 2025 at 13:06:38 UTC, Rajesh wrote:
[...]
```d
struct Problem {
this(int val) {
foreach (int number; myType)
return;
```
[...]
Is there a restriction [...]
Yes.
'this' is not allowed
On Monday, 30 June 2025 at 04:51:58 UTC, Rajesh wrote:
On Sunday, 29 June 2025 at 21:56:19 UTC, 0xEAB wrote:
On Sunday, 29 June 2025 at 13:06:38 UTC, Rajesh wrote:
Is there a restriction that I cannot call **return** from
foreach (opApply delegate) if it is executed at compile time?
To me thi
On Monday, 30 June 2025 at 14:30:49 UTC, Manfred Nowak wrote:
On Sunday, 29 June 2025 at 13:06:38 UTC, Rajesh wrote:
[...]
```d
struct Problem {
this(int val) {
foreach (int number; myType)
return;
```
[...]
Is there a restriction [...]
Yes.
'this' is not allowed
On Monday, 30 June 2025 at 14:22:47 UTC, H. S. Teoh wrote:
On Mon, Jun 30, 2025 at 04:51:27AM +, Rajesh via
Digitalmars-d-learn wrote: [...]
```
Error: variable `__capture` cannot be read at compile time
onlineapp.d(27):called from here: `Problem(0).this(1)`
auto compile_time_var = P
On Monday, 30 June 2025 at 14:22:47 UTC, H. S. Teoh wrote:
...
This article may help clear up any misunderstanding that may
have caused this problem:
https://wiki.dlang.org/Compile-time_vs._compile-time
T
That is a wonderful article! I just finished reading it. Thank
you for link
On Sunday, 29 June 2025 at 13:06:38 UTC, Rajesh wrote:
[...]
```d
struct Problem {
this(int val) {
foreach (int number; myType)
return;
```
[...]
Is there a restriction [...]
Yes.
'this' is not allowed to have a 'return' (15.13.0.2) ...
and to exit a 'foreach'-loop
On Mon, Jun 30, 2025 at 04:51:27AM +, Rajesh via Digitalmars-d-learn wrote:
[...]
> ```
> Error: variable `__capture` cannot be read at compile time
> onlineapp.d(27):called from here: `Problem(0).this(1)`
> auto compile_time_var = Problem(1);
> ```
[...]
This article may help clear up
On Sunday, 29 June 2025 at 21:56:19 UTC, 0xEAB wrote:
On Sunday, 29 June 2025 at 13:06:38 UTC, Rajesh wrote:
Is there a restriction that I cannot call **return** from
foreach (opApply delegate) if it is executed at compile time?
To me this looks like a compiler bug where it runs into a wrong
On Monday, 30 June 2025 at 02:21:29 UTC, WraithGlade wrote:
On Sunday, 29 June 2025 at 13:06:38 UTC, Rajesh wrote:
This is simplified code which I am using in my project.
...
Welcome to the forum and good luck in your programming
endeavors Rajesh.
Honestly, it isn't clear what you are even
On Sunday, 29 June 2025 at 13:06:38 UTC, Rajesh wrote:
This is simplified code which I am using in my project.
...
Welcome to the forum and good luck in your programming endeavors
Rajesh.
Honestly, it isn't clear what you are even trying to do in your
code and thus it would probably be eas
On Sunday, 29 June 2025 at 13:06:38 UTC, Rajesh wrote:
Is there a restriction that I cannot call **return** from
foreach (opApply delegate) if it is executed at compile time?
To me this looks like a compiler bug where it runs into a wrong
assumption once it finds the return statement in the fo
This is simplified code which I am using in my project.
```
struct NumberType
{
int num;
int opApply(int delegate(int) dg)
{
int result = dg(num);
return result;
}
}
struct Problem {
int value;
this(int val) {
auto myType = NumberType(18);
13 matches
Mail list logo