Skip to content

Conversation

@toots
Copy link
Member

@toots toots commented Oct 11, 2022

…cross to define top-level fallback operator, define switch using it.

@toots toots force-pushed the switch-transitions branch from a62e650 to 48b0378 Compare October 11, 2022 18:05
…cross to define top-level fallback operator, define switch using it.
@toots toots force-pushed the switch-transitions branch from 48b0378 to 40b5dee Compare October 11, 2022 21:04
@smimram
Copy link
Member

smimram commented Oct 14, 2022

I think the best abstraction would be a select operator such that

select(f, l)

with

  • f of type unit -> int
  • l of type source list
    plays the f()th source.

We can implement fallback over this.

@toots
Copy link
Member Author

toots commented Oct 14, 2022

I think the best abstraction would be a select operator such that

select(f, l)

with

  • f of type unit -> int
  • l of type source list
    plays the f()th source.

We can implement fallback over this.

Can you explain more in details why? I'm not sure the benefit is immediate to me.

There's a complex interaction between source.is_ready and switch predicates that makes switch implementation tricky. When starting with a fallback based on source.is_ready, the low-level implementation is pretty straight forward. Then we can build on top of that using source.available to implement the switch, still following a strict logic based on source availability..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants