On 4/29/21 1:50 PM, Meta wrote:


The reason for this, apparently, is in the definition of `ifThrown`:
```
CommonType!(T1, T2) ifThrown(E : Throwable = Exception, T1, T2)(lazy scope T1 expression, lazy scope T2 errorHandler) nothrow
```

It's not marked as `nothrow` in the function's definition, so even if the delegate passed to ifThrown _is_ nothrow, the compiler can't tell. There's no easy way around this that I can think of OTOH that doesn't involve some effort on your part.

Wait, I don't get what you are saying. You mean it should be marked nothrow? It's a template, so it *should* be inferred nothrow if it were actually nothrow.

The current definition is not marked nothrow as you alluded, and when I do mark it nothrow, it complains that the lazy parameter used for the exception handler is not nothrow.

It seems there's no way to infer the throwing of the lazy parameter, lazy parameters are never nothrow.

The higher order function DIP would I think help with this.

-Steve

Reply via email to