develooper Front page | perl.perl5.porters | Postings from December 2019

Re: Query Parameters

Thread Previous | Thread Next
From:
Zefram via perl5-porters
Date:
December 3, 2019 13:44
Subject:
Re: Query Parameters
Message ID:
20191203134352.lpe3yftebgryrrwb@fysh.org
Dave Mitchell wrote:
>In the absence of any named params (or trailing hash slurpy), no runtime
>parity check is done on the args.

These semantics are sounding awkward.  You've got one set of semantics
for consuming signature items, and a separate set of semantics for
lookahead signature items that have parallel syntax.  I think it needs
to be simpler: a lookahead signature item should be able to contain any
signature item, and should have identical semantics to its sub-item apart
from not consuming any arguments (and consequently not restricting what
order items can come in).

This simple rule, if done fully, incidentally implies that you can't have
"?" to introduce lookahead alongside "??" for a predicate, because there's
no semantic problem with nesting lookahead inside lookahead.  I suggest
that lookahead should be signalled by "?=", imitating the regexp syntax.
So, matching semantics, "?=%foo" has to impose a parity requirement,
and "?=$foo" has to require that there be at least one more argument.
"?=%" and "?=$" (with no identifier) are actually not no-ops: they impose
these argc requirements without doing anything else.

-zefram

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