D: How to check if a function is chained? a().b().c();

2023-11-17 Thread BoQsc via Digitalmars-d-learn
Let's say we have a chain of functions. ``` a().b().c(); ``` I would like to have a behaviour in `a()` that would check if there is `b()` or `c()` chained to it. If `a();`is not chained: do a `writeln("You forgot to chain this function!");` A function that executes a program For me

Re: How to do reflection on alias symbols

2023-11-17 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, November 17, 2023 2:11:30 AM MST Arafel via Digitalmars-d-learn wrote: > I mean, in order to know if something is an `enum`, I need to do: > > ```d > enum isEnum(alias a) = is(typeof(a)) && !is(typeof(&a)); > ``` > > which feels like the wrong approach, and too much error-prone. I also

Re: How to do reflection on alias symbols

2023-11-17 Thread Arafel via Digitalmars-d-learn
On 17/11/23 2:48, Jonathan M Davis wrote: On Thursday, November 16, 2023 6:04:43 PM MST Jonathan M Davis via Digitalmars-d-learn wrote: Actually, it looks like there's already an old bug report on the issue: https://issues.dlang.org/show_bug.cgi?id=12363 So, it has been reported, but it looks