On Tuesday, 7 May 2024 at 01:14:24 UTC, Steven Schveighoffer
wrote:
On Tuesday, 7 May 2024 at 00:10:27 UTC, Andy Valencia wrote:
I had a set of default error messages to go with error code
numbers, and did something along the lines of:
string[uint] error_text = [
400: "A message",
On Tuesday, 7 May 2024 at 00:10:27 UTC, Andy Valencia wrote:
I had a set of default error messages to go with error code
numbers, and did something along the lines of:
string[uint] error_text = [
400: "A message",
401: "A different message"
];
and got "expression is not a
On Tuesday, 7 May 2024 at 01:02:04 UTC, matheus wrote:
On Tuesday, 7 May 2024 at 00:10:27 UTC, Andy Valencia wrote:
...
Based on what I understood and that issue, I think it was fixed:
...
By the way it works as immutable too.
Matheus.
On Tuesday, 7 May 2024 at 00:10:27 UTC, Andy Valencia wrote:
I had a set of default error messages to go with error code
numbers, and did something along the lines of:
string[uint] error_text = [
400: "A message",
401: "A different message"
];
and got "expression is not a
I had a set of default error messages to go with error code
numbers, and did something along the lines of:
string[uint] error_text = [
400: "A message",
401: "A different message"
];
and got "expression is not a constant"
I eventually found this discussion:
On Monday, 6 May 2024 at 18:06:53 UTC, Julian Fondren wrote:
On Monday, 6 May 2024 at 17:55:49 UTC, user1234 wrote:
I think this just works:
```d
enum Flag : bool
{
no,
yes
}
alias AllowVancancy = Flag; // example usage
```
```d
import std.stdio : writeln;
enum Flag : bool { no,
On Monday, 6 May 2024 at 17:55:49 UTC, user1234 wrote:
I think this just works:
```d
enum Flag : bool
{
no,
yes
}
alias AllowVancancy = Flag; // example usage
```
```d
import std.stdio : writeln;
enum Flag : bool { no, yes }
alias Traditional = Flag;
alias Color = Flag;
void
I think this just works:
```d
enum Flag : bool
{
no,
yes
}
alias AllowVancancy = Flag; // example usage
```
Also this is completion friendly whereas Phobos version does not
permit DCD completion as it's based on opDispatch.
Compare to phobos version:
```d
template Flag(string name)
On Wednesday, 1 May 2024 at 15:18:03 UTC, Steven Schveighoffer
wrote:
On Wednesday, 1 May 2024 at 01:09:33 UTC, Liam McGillivray
wrote:
This is presumably such a common task that I'm surprised it
isn't easy to find the answer by searching;
Is there a standard library function that removes all
On Monday, 6 May 2024 at 06:29:49 UTC, Liam McGillivray wrote:
Delegates can be a pain, as they often have results different
from what one would intuitively expect. This can easily result
in bugs.
Here's a line that caused a bug that took me awhile to find:
```
foreach(card; unitCards)
On Monday, 6 May 2024 at 06:29:49 UTC, Liam McGillivray wrote:
Here's a line that caused a bug that took me awhile to find:
```
foreach(card; unitCards) card.submitted = delegate() =>
selectUnit(card.unit);
```
I think you can do:
```d
import std.algorithm.iteration : each;
On Monday, 6 May 2024 at 06:29:49 UTC, Liam McGillivray wrote:
This is because the delegate assignment causes the local `card`
variable to remain alive. The delegate that's assigned is
linked to this variable itself, not the value at the time that
the delegate is assigned.
This is
Delegates can be a pain, as they often have results different
from what one would intuitively expect. This can easily result in
bugs.
Here's a line that caused a bug that took me awhile to find:
```
foreach(card; unitCards) card.submitted = delegate() =>
selectUnit(card.unit);
```
Each
13 matches
Mail list logo