On Thursday, 1 January 2026 at 17:01:25 UTC, zhade wrote:

Is this the supposed way to do it?

The api was not written to be introspective and d's type theory has holes in it

Given a clean slate and modern knowledge and a design goal of allowing introsection I would expect `return typeof(return).init;` to work. Youd have to be writting your own algorthims lib tho.

If your lamda was an alias and you knew the range was empty on init you should be able to get this sort of thing working:

```d
alias F=...;
if(cond1){
  return r.map!F;
} else {
  return typeof(r).init.map!F;
}
```

but your off the garden path and your likely learn some new compiler bugs :D

Reply via email to