I cannot think of a sensible way to make the smart-match dispatch table modifiable. With the string-table, there's no order of tests, so I can just stick the new test in without regard for where it goes. With the smart-match, there is an order of tests. Do you have suggestions for this?
I think of modifying the table as a kind of nifty feature that is likely to be little-used. Why do you see it as important?
The default case does need to be at the end of the list. I will make that explicit in the docs.
You're probably right about treating ranges as unordered. That's actually a fix where I get to remove code. I had thought it would be a convenience. I also toyed with the idea of a reversed pair signifying "not between". But I don't think there's any value in that, either.
The perplexing paragraph can probably be removed. It is in anticipation of people considering it a misfeature not to handle arrayrefs as arrayrefs. It merely points out that instead of
[ $arrayref ] => sub { something }, # if it handled arrayrefs as arra
+yrefs
you could actually do
$arrayref => sub { something } , # treat $arrayref as a list of te
+sts
and
# instead of
[ $arrayref, 'foo' ] => sub { something },
# do this
$arrayref => sub { Case::resume() },
[ 'foo' ] => sub { something },
I greatly appreciate your comments.
Caution: Contents may have been coded under pressure.
|