On 1 August 2010 19:24, karl williamson <public@khwilliamson.com> wrote: > But anyway, the new stringification would be (?Cd-xism:foo) or > (?Cdmx-is:foo). Is there a reason that the Cd needs to be output? If not, > why do the 'xism' always have to be output? A short answer to why the /xism/ part has to be output: the (?...) fragment should be sufficient /alone/ to /exactly/ specify how the snippet is to match, otherwise it cannot be safely embedded into other patterns without the meaning changing. However, /p does NOT always get output as it cannot be disabled, it affects the behavior of the match buffers, not the semantics of the pattern so it need only be present /somewhere/ in the pattern. demerphq@gemini:~$ perl -le'print qr/foo/p' (?p-xism:foo) demerphq@gemini:~$ perl -le'print qr/foo/pmsix' (?pmsix:foo) Id like to call your attention to a little problem that caused test failures when I tried changing it when I did the /p stuff: yorton@mc02ppcapp-03:~$ perl -le'print qr/foo/msix' (?msix:foo) yorton@mc02ppcapp-03:~$ perl -le'print qr/foo/' (?-xism:foo) Notice the order of the flags is mirrored. If you change this it /will/ break. The /p modifier is always placed at the front. I dont think you want to follow this with a two letter modifier. I personally would not like to see: qr/foo/mxCd be turned into qr/(?Cdmx:...)/ I would want to see: qr/(?mxCd:...)/ I have to say, in all the discussion about what modifers to use, this aspects of choosing two digit modifiers seems like it hasn't been completely thought through.. With one letter modifers one can use a charclass to determine validity. With two letter modifiers order becomes important and one must use more complex validation mechanisms. Also, the implementation would probably be considerably simpler with one-letter modfiers. I think perhaps we might end up regretting introducing two letter modifiers. Especially as there is prior art for using /U and things like that elsewhere. This isnt just a bike-shed argument there /are/ subtle issues involved here. Using a lot of /(?:...)/ has a measurable effect on the speed of parsing patterns. If we introduce more complexity into the process we will make this problem worse. Im sorry to bring it up tho. Cheers, yves -- perl -Mre=debug -e "/just|another|perl|hacker/"Thread Previous | Thread Next