Front page | perl.perl5.porters |
Postings from December 2019
Re: Query Parameters
From:
Zefram via perl5-porters
Date:
December 3, 2019 13:56
Subject:
Re: Query Parameters
Message ID:
20191203135612.zpymdhwpv72zorkc@fysh.org
Dave Mitchell wrote:
>I'm happy for it to become the other way round:
>
> ?$x peek ahead and see if there is a next arg
> ??$x peek ahead to the next arg
I dislike "??". Looks too much like you're doing something really weird:
it's so weird that you have to warn the reader with a double question
mark. The general lookahead is certainly a weirder operation than
the predicate, but I don't think either of them justify such prominent
signalling. In another message on this subthread I've suggested "?="
for lookahead, imitating the regexp syntax.
>But personally I don't like the idea of quietly ignoring noops - I can't
>see any good reason not to croak. Maybe it indicates a typo or thinko?
It would be unPerlish to croak. This isn't Python. There are some
problems that arise from keeping quiet about no-ops that look like they do
something, such as passing an import list to an undefined import method,
or passing excess arguments to a sub that doesn't check how many it got.
But those situations involve action at a distance, where the call site
looks like it's doing something meaningful, and you can only work out that
it's a no-op by examining the distant code that it invokes. The no-op
signature items that we're concerned with *look* like no-ops. You don't
have to look at any other bit of code, their no-op nature is inherent
and just naturally arises from the composition of signature features.
Orthogonal composition is the greater value here.
-zefram