whitequark[cis] changed the topic of #amaranth-lang to: Amaranth hardware definition language · weekly meetings: Amaranth each Mon 1700 UTC, Amaranth SoC each Fri 1700 UTC · code https://github.com/amaranth-lang · logs https://libera.irclog.whitequark.org/amaranth-lang · Matrix #amaranth-lang:matrix.org
<crzwdjk> An RFC for fancier pattern matching would definitely be relevant to my interests, namely writing parsers in Amaranth.
josuah has joined #amaranth-lang
<_whitenotifier-3> [amaranth] github-merge-queue[bot] created branch gh-readonly-queue/main/pr-1004-8cd8cdde2b62527a655cc4e374ab28ac6b3f4822 - https://github.com/amaranth-lang/amaranth
<_whitenotifier-3> [amaranth-lang/amaranth] github-merge-queue[bot] pushed 2 commits to main [+0/-0/±2] https://github.com/amaranth-lang/amaranth/compare/8cd8cdde2b62...82d35fb93243
<_whitenotifier-3> [amaranth-lang/amaranth] whitequark 8dec39d - docs/lang: expand to include all control flow syntax.
<_whitenotifier-3> [amaranth-lang/amaranth] whitequark 82d35fb - docs/lang: document clock domains.
<_whitenotifier-3> [amaranth] whitequark closed pull request #1004: Expand language guide to include all control flow syntax - https://github.com/amaranth-lang/amaranth/pull/1004
<_whitenotifier-3> [amaranth] github-merge-queue[bot] deleted branch gh-readonly-queue/main/pr-1004-8cd8cdde2b62527a655cc4e374ab28ac6b3f4822 - https://github.com/amaranth-lang/amaranth
<_whitenotifier-3> [amaranth] whitequark closed issue #661: Order of bits within pattern syntax should be documented - https://github.com/amaranth-lang/amaranth/issues/661
<_whitenotifier-3> [amaranth-lang/amaranth-lang.github.io] whitequark pushed 1 commit to main [+0/-0/±37] https://github.com/amaranth-lang/amaranth-lang.github.io/compare/6c4a03257260...eaf4a91a7117
<_whitenotifier-3> [amaranth-lang/amaranth-lang.github.io] github-merge-queue[bot] eaf4a91 - Deploying to main from @ amaranth-lang/amaranth@82d35fb93243aa8bdc50bf13be0f4cba472d037d 🚀
crzwdjk has quit [Ping timeout: 260 seconds]
richardeoin has quit [Ping timeout: 256 seconds]
richardeoin has joined #amaranth-lang
mindw0rk has quit [Read error: Connection reset by peer]
Degi_ has joined #amaranth-lang
Degi has quit [Ping timeout: 268 seconds]
Degi_ is now known as Degi
RobTaylor[m] has joined #amaranth-lang
<RobTaylor[m]> <crzwdjk> "An RFC for fancier pattern..." <- As in parsing in hardware?
iposthuman[m] has quit [Quit: Idle timeout reached: 172800s]
jjsuperpower has quit [Ping timeout: 240 seconds]
frgo has joined #amaranth-lang
frgo has quit [Remote host closed the connection]
frgo has joined #amaranth-lang
frgo has quit [Ping timeout: 276 seconds]
frgo has joined #amaranth-lang
frgo has quit [Ping timeout: 264 seconds]
nelgau has quit [Ping timeout: 260 seconds]
nelgau has joined #amaranth-lang
frgo has joined #amaranth-lang
frgo has quit [Ping timeout: 268 seconds]
sickos has joined #amaranth-lang
nelgau has quit [Ping timeout: 252 seconds]
frgo has joined #amaranth-lang
nelgau has joined #amaranth-lang
frgo has quit [Ping timeout: 264 seconds]
frgo has joined #amaranth-lang
nelgau has quit [Read error: Connection reset by peer]
nelgau_ has joined #amaranth-lang
frgo has quit [Ping timeout: 276 seconds]
frgo has joined #amaranth-lang
frgo has quit [Ping timeout: 264 seconds]
frgo has joined #amaranth-lang
frgo has quit [Ping timeout: 264 seconds]
frgo has joined #amaranth-lang
frgo has quit [Ping timeout: 252 seconds]
sickos has quit [Quit: Client closed]
frgo has joined #amaranth-lang
<_whitenotifier-3> [amaranth-soc] jfng opened pull request #64: wishbone: fix Decoder.add() check to support flipped interfaces. - https://github.com/amaranth-lang/amaranth-soc/pull/64
<_whitenotifier-3> [amaranth-soc] github-merge-queue[bot] created branch gh-readonly-queue/main/pr-64-622c7ac415abe744a6fccb8d1cb3b06cb4f1ce35 - https://github.com/amaranth-lang/amaranth-soc
<_whitenotifier-3> [amaranth-lang/amaranth-soc] github-merge-queue[bot] pushed 1 commit to main [+0/-0/±1] https://github.com/amaranth-lang/amaranth-soc/compare/622c7ac415ab...87ee8a52d07a
<_whitenotifier-3> [amaranth-lang/amaranth-soc] jfng 87ee8a5 - wishbone: fix Decoder.add() check to support flipped interfaces.
<_whitenotifier-3> [amaranth-soc] jfng closed pull request #64: wishbone: fix Decoder.add() check to support flipped interfaces. - https://github.com/amaranth-lang/amaranth-soc/pull/64
<_whitenotifier-3> [amaranth-soc] github-merge-queue[bot] deleted branch gh-readonly-queue/main/pr-64-622c7ac415abe744a6fccb8d1cb3b06cb4f1ce35 - https://github.com/amaranth-lang/amaranth-soc
frgo has quit [Remote host closed the connection]
frgo has joined #amaranth-lang
<ravenslofty[m]> designing things at a high level is tricky for me; my brain doesn't like it. *sigh*
<ravenslofty[m]> anyway: let's take the vague concept of "fancier pattern matching" and call it "pattern captures" for now. suppose somebody uses multiple pattern captures in an `m.Case` and these patterns overlap in such a way that you could end up with multiple simultaneous matches. this is presently fine in the existing semantics (it's still a match) but under pattern captures this might be ambiguous
<ravenslofty[m]> does this imply that it should not replace the existing semantics and instead go into a library?
<whitequark[cis]> can you explain what the ambiguity is?
<whitequark[cis]> Switch/Case run on a "first match wins" basis; you don't get exhaustiveness checks (too expensive)
<ravenslofty[m]> `m.Case('00nn', 'nnnn')` or something like that; a mistake from the programmer (we presume)
<ravenslofty[m]> (this also has another thing I've been thinking about, which is: what's the shape of `n` here?)
<whitequark[cis]> <ravenslofty[m]> "(this also has another thing I'..." <- I think having `nn` and `nnnn` in one `Case` or `matches` should be an error (different lengths)
<whitequark[cis]> however if you had something like m.Case('0000 nnnn', '1100 nnnn'): should be allowed (why not?)
<ravenslofty[m]> I don't consider that ambiguous and would agree that it should be allowed
<ravenslofty[m]> `m.Case('0001 nnnn', '000- nnnn')` *is* ambiguous given `0001 ----`
<whitequark[cis]> we already allow m.Case('0001 0000', '000- 0000') though
<whitequark[cis]> so nnnn adds no new ambiguity
<whitequark[cis]> you could say that m.Case('0001 nnnn', 'nnnn 0000'): has a worse ambiguity
<ravenslofty[m]> sure, and that's the kind of thing I'm talking about
<galibert[m]> well, "first in the list wins" is an easy rule, much easier than trying to sort out whether they match each other
<ravenslofty[m]> and `m.Case('0001 ----', '---- 0000')` isn't an issue
<ravenslofty[m]> I disagree, Olivier, I consider this to be a usability problem and usability problems are bugs, AIUI
<galibert[m]> Ok, then explain to be in small words why 0001 ---- / ---- 0000 is not an issue while 0001 nnnn / nnnn 0000 is?
<galibert[m]> s/be/me/
<ravenslofty[m]> because `0001 ----`/`---- 0000` returns a boolean with relatively clear semantics (it's an OR of all patterns) that does not care about bit position and `0001 nnnn`/`nnnn 0000` *does* care about bit position
<ravenslofty[m]> but honestly? yes, you could absolutely make the point that the multiple overlaps is potentially a sign of a bug
<galibert[m]> python short-circuits or, so I don't find it ambiguous
<whitequark[cis]> <ravenslofty[m]> "sure, and that's the kind of..." <- what I'm saying here is that this should probably not be in scope for the RFC you're writing, since it's existing behavior
<whitequark[cis]> I'm completely open to discussing two RFCs, one that adds captures and one that resolves this ambiguity
<ravenslofty[m]> Okay, I guess I'll just throw this in future possibilities
<ravenslofty[m]> I feel like my relatively limited knowledge of "advanced python"™️ hinders me a bit when trying to design things
<ravenslofty[m]> like, I'm designing this with some underlying assumption that somebody Better Than I will know the right way to do it
crzwdjk has joined #amaranth-lang
<crzwdjk> RobTaylor[m]: Yes, parsing in hardware, in my case of terminal escape codes.
smkz has joined #amaranth-lang
jjsuperpower has joined #amaranth-lang
cr1901 has quit [Read error: Connection reset by peer]
cr1901 has joined #amaranth-lang
pbsds has quit [Quit: Ping timeout (120 seconds)]
pbsds has joined #amaranth-lang
key2 has quit [Ping timeout: 245 seconds]
key2 has joined #amaranth-lang
_alice has quit [Read error: Connection reset by peer]
LoveMHz has quit [Read error: Connection reset by peer]
esden has quit [Read error: Connection reset by peer]
_alice has joined #amaranth-lang
LoveMHz has joined #amaranth-lang
esden has joined #amaranth-lang
sugarbeet has quit [Ping timeout: 245 seconds]
sugarbeet has joined #amaranth-lang
jjsuperpower has quit [Remote host closed the connection]
jjsuperpower has joined #amaranth-lang
frgo has quit [Remote host closed the connection]
frgo has joined #amaranth-lang
frgo has quit [Ping timeout: 264 seconds]
frgo has joined #amaranth-lang
frgo has quit [Ping timeout: 260 seconds]
frgo has joined #amaranth-lang
frgo has quit [Ping timeout: 245 seconds]
frgo has joined #amaranth-lang
frgo has quit [Ping timeout: 252 seconds]
frgo has joined #amaranth-lang
frgo has quit [Ping timeout: 260 seconds]
frgo has joined #amaranth-lang
frgo has quit [Ping timeout: 246 seconds]
frgo has joined #amaranth-lang
frgo has quit [Ping timeout: 240 seconds]
frgo has joined #amaranth-lang
frgo has quit [Ping timeout: 256 seconds]
frgo has joined #amaranth-lang
frgo has quit [Ping timeout: 260 seconds]
frgo has joined #amaranth-lang
frgo_ has joined #amaranth-lang
frgo has quit [Ping timeout: 256 seconds]
frgo_ has quit [Ping timeout: 256 seconds]
frgo has joined #amaranth-lang
frgo has quit [Ping timeout: 255 seconds]
frgo has joined #amaranth-lang
frgo has quit [Remote host closed the connection]
frgo has joined #amaranth-lang
frgo has quit [Ping timeout: 260 seconds]
frgo has joined #amaranth-lang
frgo has quit [Ping timeout: 264 seconds]