On Wednesday 09 May 2007 12:53:57 Nicholas Clark wrote: > On Tue, May 01, 2007 at 04:41:22PM -0700, [EMAIL PROTECTED] wrote: > > + > > +#define STRING_IS_NULL(s) ((s) == NULL) > > +#define STRING_IS_EMPTY(s) !(int)(s)->strlen
> I'm really not convinced that the first macro brings any benefit. > I'm not totally sure that the second does either, given that both > operations are conceptually very simple. > > Code is read far more often than it is written, and I don't think that the > typing savings outweigh the learning curve of two more macros, and the > memory needed to keep two more in one's head. Does !(int)(s)->strlen really scan as quickly and easily as STRING_IS_EMPTY? > Arguably one of the mistakes of Perl 5 was to use too many macros, which > unintentionally contributes to obfuscating the code. It's not as if *these* are SvPVNL and SvPVZ, or was that SVpvNL or SvPv or....? > Is it likely that all future use of these two will be paired? If so, its it > a better idea to abolish them and replace with one macro > STRING_IS_NULL_OR_EMPTY() ? That, I could understand. -- c