develooper Front page | perl.perl5.porters | Postings from June 2015

Re: scalar sort $scalar

Thread Previous | Thread Next
From:
Zefram
Date:
June 30, 2015 13:44
Subject:
Re: scalar sort $scalar
Message ID:
20150630134417.GG23010@fysh.org
Ed Avis wrote:
>How about making split an lvalue?

Cute, but probably not useful enough for core.  Implement it as a CPAN
module.  If it turns out to be wildly popular, it could be cored later.

>Sometimes I have also wished to use string operators such as index() and
>regular expressions on lists, though what the syntax for that would be I
>have no idea.

They'd immediately run into the problems of value identity, on which
Perl is weak.  (Substring identity is well defined.)  I think you need to
apply a type system, such as Moose's, at which point it's easy enough to
construct regexps in which the atomic expressions are type references.
As it happens, I've recently implemented this very thing in my Lisp.
I don't reckon it's worth having special syntax for this generalised kind
of regexp, because the syntax for the atomic expressions isn't very short
to start with, so I just implemented the regexp operators as functions.
Regexps on lists turn out to enable some interesting stuff, and I'd like
to do a conference talk about it sometime.

-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