Closed emizzle closed 6 months ago
getCallback()
returns an Option
, and .catch
wraps that in a Result
, so the expression getCallback().catch
is of type ?!(?SubscriptionCallback)
The =?
operator only unwraps the outer Result
, but the inner Option
remains. That's why you get a compiler error.
When you unwrap the option then it does compile:
if maybeCallback =? getCallback().catch and callback =? maybeCallback:
callback(JsonNode(), JsonNode())
Makes sense, thanks Mark!
When binding to optional callbacks, with
.catch
, it seems that the compiler can't figure out the type of callback? Tried this on nim v1.6.18.Does not compile: