On Thursday, 9 May 2024 at 18:48:12 UTC, Nick Treleaven wrote:
We have a tool in our box already called `true` and that
solves the problem. If we had to type out the full name of
every argument passed to every function ever written we may as
well just adopt ObjC Cocoa style and call it
On Wednesday, 8 May 2024 at 10:24:07 UTC, Nick Treleaven wrote:
Named arguments are optional, so I don't see how they could
make Flag redundant.
Actually, an external tool could detect when a bool is passed as
an argument to a function and warn when not done with a named
argument. This would
On Thursday, 9 May 2024 at 13:40:56 UTC, cc wrote:
It's pointless mandatory verbosity. StopWatch ctor only takes
one boolean argument. It doesn't *need* to specify what it
relates to. You either already know, or you have to look it up
anyway. Flags made sense when you might get the order
On Wednesday, 8 May 2024 at 10:24:07 UTC, Nick Treleaven wrote:
On Wednesday, 8 May 2024 at 04:27:13 UTC, cc wrote:
It doesn't allow a simple boolean to be used as an argument,
or any other Flag as they are different instantiations of a
template rather than equivalent aliases.
It is however
Nick Treleaven kirjoitti 8.5.2024 klo 13.24:
On Wednesday, 8 May 2024 at 04:27:13 UTC, cc wrote:
It doesn't allow a simple boolean to be used as an argument, or any
other Flag as they are different instantiations of a template rather
than equivalent aliases.
It is however awful, cumbersome,
On Wednesday, 8 May 2024 at 04:27:13 UTC, cc wrote:
It doesn't allow a simple boolean to be used as an argument, or
any other Flag as they are different instantiations of a
template rather than equivalent aliases.
It is however awful, cumbersome, annoying design and needs to
be completely
On Monday, 6 May 2024 at 17:55:49 UTC, user1234 wrote:
I think this just works:
```d
enum Flag : bool
{
no,
yes
}
```
...
must be a reason but I cant find it RN ;)
In "properly" designed Phobos packages, it's unambiguous. Take
for example std.datetime.stopwatch:
```d
import
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)
10 matches
Mail list logo