poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [WIP][PATCH 2/2] pkl,pvm: add support for regular expression


From: Jose E. Marchesi
Subject: Re: [WIP][PATCH 2/2] pkl,pvm: add support for regular expression
Date: Wed, 15 Feb 2023 21:38:31 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

> On Wed, Feb 15, 2023 at 11:01:01AM +0100, Jose E. Marchesi wrote:
>> 
>
>> I don't think it is a good idea to expose the regexp machinery in std
>> like this.
>> 
>> I thought we were targetting adding support for STRING ~ REGEXP at the
>> language level?  The compiler can then generate calls to _pkl_re_gmatch
>> and DTRT...
>> 
>
> Yes, I wanted to enable us to use regexp for problems we already have
> sooner.
> Because we have to think about the struct patterns as a general mechanism
> and rushing to implementing regexp at language level can cause problems
> for us.

Well, it is difficult to support regexp matching with an operator while
also supporting matching groups, etc.

The operator would only evaluate to true or false.  How to convey the
other information while having ~ return a value that can be used in a
conditional?

What we could do is to have both: a ~ operator that returns true/false,
and also a pk_regexp_gmatch that returns a Pk_Regexp_Match.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]