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

Re: Revisiting smart match

Thread Previous | Thread Next
From:
D Perrett via perl5-porters
Date:
December 20, 2017 09:01
Subject:
Re: Revisiting smart match
Message ID:
CABrou+kcKLhC4G6e8B9ZzQaHqAkZM12TjbR3PKSdPnwFXQ5ZJg@mail.gmail.com
To me the syntax which makes sense is:

given SUBJECT {
  such that CONDITION BLOCK
  such as MATCHER BLOCK
}

Tangent:

Ideally I would also like to express it with other operators than ~~ so
that $_ can be omitted:

such >= 0 BLOCK

In realise that this is less natural and also that this may be much more
tricky!

Daniel

On 20 Dec 2017 1:55 a.m., "Rocco Caputo" <rcaputo@pobox.com> wrote:

On Dec 19, 2017, at 03:49, Konovalov, Vadim <Vadim.Konovalov@dell.com>
wrote:

> From: Leon Timmermans

> I think we're approaching this the wrong way.


I tossed around some ideas last night in IRC, but they were all flawed in
one way or another.

Stepping back, I think most people are trying to fill this template:

"considering" SUBJECT {
  "if it's true that" CONDITION { ... }
  "if the thing being considered matches" MATCHER { ... }

  # and

  do { ... } "if it's true that" CONDITION;
  do { ... } "if the thing being considered matches" MATCHER;
}

Given the amount of effort that's been put into finding a succinct
solution, maybe it's not possible in English.  It may be worth thinking
about different templates entirely, or relaxing the "succinct" or "English"
constraints.

As a language, English has no shame.  It won't mind if Perl ganks a few
more words from elsewhere.

I don't recall seeing the problem expressed this way.  Sorry if it was and
I missed it.  I hope someone finds this useful.

-- 
Rocco Caputo <rcaputo@pobox.com>

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