On Jun 30, 2015 9:38 AM, "François Laupretre" <franc...@php.net> wrote: > > Hi, > > > -----Message d'origine----- > > De : Bob Weinand [mailto:bobw...@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