On Thursday, 1 January 2026 at 19:06:44 UTC, monkyyy wrote:



also worth considering if you abuse the range api:

```d
import std;
template innate(T,int line){
        T innate;
}
auto panicswitch(int line=__LINE__,R)(R r){
        struct panicable{
                R r;
                auto front()=>r.front;
                void popFront(){r.popFront;}
                auto empty()=>innate!(bool,line) || r.empty;
                bool* getbutton()=>&innate!(bool,line);
        }
        innate!(bool,line)=false;
        return panicable(r);
}
unittest{
        auto r=iota(10)
                .map!(a=>a*2)
                .filter!(a=>a%3)
                .panicswitch;
        auto panic=r.getbutton;
        foreach(e;r){
                if(e>5){
                        *panic=true;
                }
                e.writeln;
        }
}
```

Reply via email to