Wish: Multi-Returns For UPARSE Combinators

Every combinator has a synthesized value. But some combinators throw away values synthesized by their parser parameters.

For instance, TALLY.

>> parse [1020 304] [int: some integer!]
== 304

>> parse [1020 304] [count: tally some integer!]
== 2

TALLY knows what the result of the last call it made was, but doesn't preserve it. What if you could?

>> parse [1020 304] [[count int]: tally some integer!]
== 2

>> count
== 2

>> int
== 304

That particular one is not necessarily a very interesting example, since you could get it yourself...

parse [1020 304] [count: tally int: some integer!]

I only mention it because it was in a comment in UPARSE I wanted to delete, because it's a long enough file without becoming a wishlist compilation. :-/

But there are certainly going to be other examples of combinators that might want to synthesize more than one value. So hopefully the feature can be implemented at some point...

2 Likes