Time to Meet Your MATCH... (...dialect)

So MATCH has evolved (and I've updated the descriptions above to account for it).

Note that previously this was done with quoting e.g. match ['on 'off]. But the interpretation of quoting as being used to have ['word!] match "LIT-WORD" just turned out to be more important.

Using quasi-blocks actually turned out to be better...because you aren't having to mentally subtract a quote level from what you're looking at:

old>> match [''a ''b] first ['a]  ; confusing!
== 'a

new>> match [~['a 'b]~] first ['a]  ; clearer!
== 'a

UPDATE: you can now omit the block entirely, since MATCH takes splices...even better!

>> match ~['a 'b]~ first ['a]  ; woo!
== 'a

(...and I've written elsewhere about how splices help with this "mental math" problem, which makes them a good way of talking about literal data more broadly.)

Decorations (Quote/Quasi/Sigil/Sequence) are "Taken"

One big area of what had to change is that things like CHAIN! and PATH! and TUPLE! are now matched as decorations. So [word!:] is destructured and matches things like foo:. Without this, we'd have to give everything a name to fabricate type constraints (/word!: would have to be a SET-RUN-WORD?, etc.)

This chews out a big chunk of the design space. WORD!, PATH!, TUPLE!, and CHAIN! all have their meanings sort of set-in-stone.

FENCE! and GROUP! are still left

I've thought that maybe FENCE! would be good for "AND"-ing type constraints, since BLOCK! does "OR"-ing by default.

GROUP! is used so often in composition that it's not always desirable to give it meaning in a dialect. But we could.

Decorated non-[word! path! tuple! chain!] are available

I wonder if the decoration should distribute, e.g. @[word! tuple!] as synonym for [@word! @tuple!] ?

1 Like