Another interesting thing is that if this is implemented, then it will make it possible to use ? in other places where <colonpair> is used. For example, it will allow %h<x>:?exists . It seems that it will also affect character classes (e.g. <:?Ll>). Some of these totally make sense, some not so much. But we already have :!delete and nobody seems to be complaining :)
There's also <quotepair> which has very similar logic, it does support ! but does not support ? (e.g. m:!i/ … / but no m:?i/ … /). I wonder, if <colonpair> is ever touched, should the same thing be done with <quotepair> also? On 2017-07-22 23:40:53, alex.jakime...@gmail.com wrote: > For those who don't agree that there is a connection between ? and !… > Actually, > there are some other places where ?↔! connection is implied. In fact, > I will > probably never list all of them. > > In regexes: > * <?> always succeeds, <!> always fails (and no question implied) > * <?{ … }> <!{ … }> tests for truthy and falsey values. Note that <{}> > does > something completely different. > * a+? is for non-greedy, a+! for greedy (again no question implied) > * <before>, <?before>, <!before> (note that all three are supported, > same goes > for <after>) > > > > I would also do the job for the other side and provide some counter > examples: > * There is a ! metaop but no ? metaop (e.g. !== but no ?==). If there > was one, > it would practically be a noop because you wouldn't be able to use it > on > anything non-iffy anyway. That said, it's still a weird case. > * There is [foo]? in regexes but no [foo]! . At first I thought that > this is > intentional, given that ! may be needed for something else eventually, > but > knowing that a+! works I'm no longer sure. > > This raises a question: well… should we implement these too? Maybe > this: “If > you’re gonna generalize, do it harder, but not too hard.”[^1] is > relevant here, > but maybe not. > > Bonus: > * In some cases the use of ? or ! is not related to this issue at all. > e.g. > private methods (if we allow some things to have no opposites, why > bother at > all?) > > > Anyway, that's some good food for thought I think. > > [1] https://perl6advent.wordpress.com/2014/12/24/day-24-seeing-wrong- > right/