develooper Front page | perl.perl5.porters | Postings from August 2010

Re: Any opposition still to the idea of syntax indicating defaultregex modifiers?

Thread Previous | Thread Next
From:
demerphq
Date:
August 22, 2010 14:21
Subject:
Re: Any opposition still to the idea of syntax indicating defaultregex modifiers?
Message ID:
AANLkTikr9OGzDpjpktSDuz8u6RFW0y2-H5jAEQHO0Zxh@mail.gmail.com
On 12 August 2010 16:00, Nicholas Clark <nick@ccl4.org> wrote:
> On Thu, Aug 12, 2010 at 12:51:50PM +0100, hv@crypt.org wrote:
>> Zefram <zefram@fysh.org> wrote:
>
> [Thanks for listing the possible characters]
>
>> :For our present purpose, I'd be happy with any of
>> :
>> :     _ ^ ~ * .
>>
>> FWIW, I like ^, I'd be happy with ~ or *, I dislike . and _.
>>
>> I quite like the mnemonic sense of ^ as "starting with a clean sheet", or
>> "anchoring [the flags] to a known set", though I wouldn't suggest trying
>> to mention or explain that in the documentation.
>
> Or "from the top", and the top of the page is above instructions about
> change-this-from-the-default.
>
>> I find all of ^ ~ * to be sufficiently visually distinctive (at least in
>> any font I'm used to using). I don't find any mnemonic argument for or
>> against ~. I find the quantifier sense of * slightly distracting, in that
>> it seems to contradict any mnemonic sense for its use in this context.
>>
>> I dislike . because I don't find it sufficiently visually distinctive,
>> and because it's "any" sense seems to contradict any mnemonic sense for
>> its use in this context.
>>
>> I dislike _ because it is a word character, and because it is not
>> distinctive enough from -.
>
> I realise that this is a bit of a bikeshed issue, but I agree with Hugo,
> pretty much for the reasons that he gives.

Me too with the exception that I am vehemently against using * as it
is used for "backtracking verbs" and also for quantifiers. I used it
for backtracking verbs because it shouts out "HEY IM DOING SOMETHING
FUNKY HERE".

Also I think (?* is unwise, as *? has a special meaning that is
totally different.

> I don't find ^ *that* confusing
>
> 1: it already has a second meaning, inside character classes
> 2: I already look with suspicion at any ^ used at any position other than the
>   start of a regexp, as things like /(^beer|pie)/ don't do what some people
>   expected

Agreed. These days I tend to avoid ^ even when it is correct and use
\A instead, except when I really really mean to use ^.

Especially these days with loads of people brainwashed by bogus PBP
arguments that all regexes should have msx enabled. Ugh.

cheers,
Yves

-- 
perl -Mre=debug -e "/just|another|perl|hacker/"

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About