Re: [pcre-dev] Proposal for a new API for PCRE

Page principale
Supprimer ce message
Auteur: ph10
Date:  
À: Ze'ev Atlas
CC: pcre-dev@exim.org
Sujet: Re: [pcre-dev] Proposal for a new API for PCRE
On Tue, 27 Aug 2013, Ze'ev Atlas wrote:

> Seeing it in the context (pun not intended)  of old style programming
> languages, to which my port (PCRE for native z/OS) is catering, I'd
> lament the extra work and complexity, although, I'd probably be able
> to do the port for that API as well.


I would argue that it is not that much more complex. In the "simple
example" section of the document, the old example is 23 lines long, and
the new example is 25 lines long. Not very different.

> I understand that I am a part of a backwards camp of people who are
> not that excited about OO approach.


As I remarked in a previous post, I don't myself think it really is an
OO approach.

>  I would like however to borrow from the OO terminology, is there a
> way to encapsulate all the extra preparations so the poor programmer
> would not need to do all this extra [confusing] coding?  


For "simple" applications, the only extra preparations are one call to
pcre2_init_context() and one call to pcre2_create_match_data(). The
simplest interface of all is of course the POSIX wrapper, and that will
remain unchanged. All the extra coding will be hidden, though the POSIX
wrapper cannot provide all the functionality of the native API.

Philip

--
Philip Hazel