RE: [PHP-DEV] Improved zend_string API

From: Date: Tue, 30 Jun 2015 02:56:32 +0000
Subject: RE: [PHP-DEV] Improved zend_string API
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-86956@lists.php.net to get a copy of this message
On Jun 30, 2015 9:38 AM, "François Laupretre" <francois@php.net> wrote: > > Hi, > > > -----Message d'origine----- > > De : Bob Weinand [mailto:bobwei9@hotmail.com] > > > > Hey, looks like I'm a bit late to the party, but I'd like to object against the > > accessor macros on zend_string. > > > > What does it help to replace very nice ->val, ->len etc. with macros? > > If you find it 'very nice', probably nothing. I suggest you stop using macros everywhere. After all, why did we define Z_STRVAL() instead of writing something 'very nice' like 'zv.value.str->val' ? Just one reason : if we had written 'zv.value.val' everywhere, zend_strings couldn't exist today. > > In a few words, we are improving encapsulation : publishing an API instead of a C structure. I agree here. It is good practice to do not expose structure directly. It prevents structure or behavior changes without users code modifications. Using an API only requires a compilation without any code change. I am not a fan of macros everywhere (we have way too much :) but this is not a reason to expose strict. Cheers, Pierre

« previous php.internals (#86956) next »