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

Re: Revisiting smart match

Thread Previous | Thread Next
From:
Zefram
Date:
November 28, 2017 17:50
Subject:
Re: Revisiting smart match
Message ID:
20171128175006.GM4913@fysh.org
Father Chrysostomos wrote:
>                                    Do we need to break code already
>using break?

It seems an insignificant amount of breakage, next to breaking almost
all uses of smartmatch and half or maybe all the uses of "when".  If we
want to reconsider any of the original design decisions, now is the time
to get all the changes in.

>I do like 'when'.  But how about 'have' meaning 'when we have'?

"when" reads reasonably, but has other problems that I mentioned.  "have"
reads poorly, especially in its postfix form.  I'm not happy with either
of them.

It's difficult to squeeze as much meaning as "handle all topics of this
kind by this means, and this resolves the topic without needing to
consider it further" into one word, let alone a keyword-length word.
I'd hoped that my perusal of Roget would turn something up, but it
produced very little.  The thought process with "having" and "being"
was that we can't get the connotation of resolution in the word, so best
to concentrate on the other part.  But in the case of the truth-value
condition, the other part is just "if", so we need a synonym for "if", and
we had therefore better make it as distinct from "if" as possible to at
least hint that it's not the same thing.  The other keyword needs to mean
"if the topic is of this kind", which is still a lot to fit into one word.

>My immediate reaction is to think it very unperlish:
>
>    do_stuff() generally;

That looks pretty Perlish to me.  The postfix qualifier is a distinctively
Perlish construct, and with the keyword being an adverb the statement
reads naturally as an English sentence, which is a Perlish concern.

>                               I do not expect ever to use 'default',
>since it really serves no purpose.

In the spirit of breaking everything at once, is it worth removing
"default" as being too misleading?  As you point out, it behaves nothing
like the C keyword from which it's derived.

-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