Stream: project-error-handling

Topic: Try operator in destructure


view this post on Zulip Jeremiah Senkpiel (Mar 24 2021 at 00:24):

Has there been any talk about allowing the Try (?) operator in a destructure position like this?

iter.inspect(|(_, thing)?|  { ... })

This could be quite handy when working with result-yielding iterators.

view this post on Zulip Jeremiah Senkpiel (Mar 24 2021 at 00:24):

(Maybe there is a better place to ask this?)

view this post on Zulip Jane Lusby (Mar 24 2021 at 00:24):

not that I know of

view this post on Zulip Jane Lusby (Mar 24 2021 at 00:25):

this is a langs team issue though, try operator and block is explicitly out of scope for this project group

view this post on Zulip Jeremiah Senkpiel (Mar 24 2021 at 00:25):

Got it, should I move this to t-lang?

view this post on Zulip Jane Lusby (Mar 24 2021 at 00:26):

yea, that would probably be the best way to move this forward

view this post on Zulip Josh Triplett (Mar 24 2021 at 05:48):

@Jeremiah Senkpiel I haven't seen any such proposals floated, even speculatively.

view this post on Zulip scottmcm (Mar 27 2021 at 01:05):

The only version of this I've seen proposed was in the context of for x? in iterator_of_results.

The inspect one seems surprising to me since I'm not sure what type signature it's expected to provide. The for version was something like desugaring for x? in ... { to for x in ... { let x = x?; (IIRC), but I'm not sure how to do that in a -> () method like inspect.


Last updated: Jan 26 2022 at 14:02 UTC