You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is because Telemere currently expects provided opts to be a compile-time map. The map vals don't necessarily need to be compile-time consts, but the opts map itself does need to be.
This limitation could probably be relaxed or removed, and might be useful to do. At the very least the limitation should be clearly documented in the meantime, and it'd be nice if a clearer error message were thrown. Will take a look at this when I'm next on batched Telemere work.
Workarounds
In the meantime, folks wanting to do something like the above have a few options:
Update: after further thoughts and experimenting on this, I think it's actually probably best -not- to relax the restrictions on this since that can lead to unexpected results.
Instead, the next release will include:
Additional mentions in the docs about this restriction.
Support for single-arg (opts map) signal creators, which can help make custom wrappers easier.
I'll also see about improving error messages where possible 👍
The below currently throws an "Invalid level" exception:
Limitation
This is because Telemere currently expects provided opts to be a compile-time map. The map vals don't necessarily need to be compile-time consts, but the opts map itself does need to be.
This limitation could probably be relaxed or removed, and might be useful to do. At the very least the limitation should be clearly documented in the meantime, and it'd be nice if a clearer error message were thrown. Will take a look at this when I'm next on batched Telemere work.
Workarounds
In the meantime, folks wanting to do something like the above have a few options:
(1) Use a macro wrapper instead, e.g.:
Note that signal! is often easier to use when writing such wrappers.
(2) Use a wrapper fn instead, e.g.:
Though note that (2) will mean losing callsite information.
(3) Instead move the extra functionality you want to middleware, etc.
cc @Knotschi
The text was updated successfully, but these errors were encountered: