I want to get a reference to a parent function from inside a
nested function. I need it for `getUDAs!(parentFunction,
attribute)`.
`__traits(parent, mixin(__FUNCTION__))` works inside the parent
function and gives me the module, but `mixin(__FUNCTION__)` alone
inside the nested function immed
On Saturday, February 15, 2025 1:12:43 PM MST Paul Backus via
Digitalmars-d-learn wrote:
> On Saturday, 15 February 2025 at 15:40:51 UTC, Dom DiSc wrote:
> > On Friday, 14 February 2025 at 15:58:26 UTC, Paul Backus wrote:
> >> Oops--it turns out both overloads are equally specialized!
> >
> > This
On Saturday, February 15, 2025 9:33:06 PM MST Andy Valencia via
Digitalmars-d-learn wrote:
> On Saturday, 15 February 2025 at 19:27:19 UTC, Ian wrote:
> > canFind is Perfect. Thank you.
>
> If performance is an issue, putting them as keys in an
> Associative Array and simply using "in" should scal
On Saturday, 15 February 2025 at 19:27:19 UTC, Ian wrote:
canFind is Perfect. Thank you.
If performance is an issue, putting them as keys in an
Associative Array and simply using "in" should scale nicely to
even very large numbers of strings to search.
Andy
On Saturday, 15 February 2025 at 15:40:51 UTC, Dom DiSc wrote:
On Friday, 14 February 2025 at 15:58:26 UTC, Paul Backus wrote:
Oops--it turns out both overloads are equally specialized!
This is what I want to be fixed. For a human it is obvious
which of the two is a better match. Lets add a r
I think full sumtypes are probably usually overkill and I rarely
use it; but I have some lib ideas that need... something
```d
struct shape{
int w,h;
bool isCircle()=>h==-1;
bool isSquare()=>w==h;
bool isRect()=>h!=-1 && w!=h;
}
void drawCircle(shape s){
assert(s.isCircle)
...
```
Cla
On Saturday, 15 February 2025 at 18:13:39 UTC, Sergey wrote:
On Saturday, 15 February 2025 at 17:58:44 UTC, Ian wrote:
Hi,
What's the best (idiomatic) way of checking if a string is in
a list of strings:
```d
string v = "tofind";
if (v ismemberof ["abc", "def","tofind"])
etc();
```
Thank
On Saturday, 15 February 2025 at 11:47:58 UTC, Inkrementator
wrote:
I put `r.findnext!(i => F(i))` instead of `r.findnext!(F)`. I
h I would consider that a compiler bug if that ever changed
the behavior but I see how that may de-confuse the compiler.
Would you expect that style change wo
On Saturday, 15 February 2025 at 17:58:44 UTC, Ian wrote:
Hi,
What's the best (idiomatic) way of checking if a string is in a
list of strings:
```d
string v = "tofind";
if (v ismemberof ["abc", "def","tofind"])
etc();
```
Thanks,
ian
canFind or countUntil
https://dlang.org/phobos/std_a
Hi,
What's the best (idiomatic) way of checking if a string is in a
list of strings:
```d
string v = "tofind";
if (v ismemberof ["abc", "def","tofind"])
etc();
```
Thanks,
ian
On Friday, 14 February 2025 at 15:58:26 UTC, Paul Backus wrote:
In your example, both overloads have match level 2: "match with
implicit conversions". So the compiler attempts to figure out
which one is more specialized by checking whether the
parameters of one overload can be used to call the
On Saturday, 15 February 2025 at 11:47:58 UTC, Inkrementator
wrote:
Wrapping foo in another delegate seems to at least compile.
Same as splitting out the struct. I don't understand why a struct
outside of a function gets treated differently than a static
struct.
```
auto split(alias F,R)(R
On Thursday, 6 February 2025 at 20:08:36 UTC, monkyyy wrote:
I have template hell code; eventually 5 nested range calls have
dual context-y issues and maybe compiler bugs; adding static
makes those errors go away, adding static to everything makes
new bugs.
Wack-a-mole when the compiler gets
On Saturday, February 15, 2025 12:53:17 AM MST IchorDev via Digitalmars-d-learn
wrote:
> If I have a module-level variable, each thread sees a different
> value for it. But how would I create a module-level variable that
> can only be accessed by one thread? Do I have to give it its own
> module?
On Wednesday, 12 February 2025 at 00:20:02 UTC, Andy Valencia
wrote:
I was wondering about an @safe dlang version of AES, and just
couldn't find one. (Well, there was one, but without any of
the nonce/IV stuff.) I know many will be perfectly happy with
calls into C libraries, but for those wh
15 matches
Mail list logo