Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RFC for Choice. #52

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

wanda-phi
Copy link
Member

@wanda-phi wanda-phi commented Mar 5, 2024

@whitequark whitequark added meta:nominated Nominated for discussion on the next relevant meeting area:core RFC affecting APIs in amaranth-lang/amaranth labels Mar 5, 2024
@whitequark
Copy link
Member

whitequark commented Mar 5, 2024

Guard syntax bikeshed:

  1. Just stuff it in the list:
Choice(foo, {
  (1, guard): bar
})
  1. Context manager:
with Choice(foo) as c:
    with c.Case(1, if=guard):
        c.eq(bar)
  1. Explicit Guard primitive:
Choice(foo, {
  Guard(1, if=guard): bar
})

with m.Switch(foo):
    with m.Case(Guard(1, if=guard)):
        ...

(I don't love any of these. They're also all backward compatible.)

@wanda-phi
Copy link
Member Author

Guard syntax bikeshed:

1. Just stuff it in the list:
Choice(foo, {
  (1, guard): bar
})

That won't work (Value is not hashable)

@wanda-phi wanda-phi force-pushed the choice branch 2 times, most recently from 0e4fa0d to ad2a0a0 Compare March 10, 2024 06:05
@whitequark whitequark removed the meta:nominated Nominated for discussion on the next relevant meeting label Mar 18, 2024
@whitequark whitequark added the meta:nominated Nominated for discussion on the next relevant meeting label Mar 21, 2024
@whitequark whitequark removed the meta:nominated Nominated for discussion on the next relevant meeting label Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:core RFC affecting APIs in amaranth-lang/amaranth
2 participants