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.


Arguably one of the mistakes of Perl 5 was to use too many macros, which
unintentionally contributes to obfuscating the code.


>  /* &gen_from_def(sysinfo.pasm) prefix(SYSINFO_) */
>  
>  #define PARROT_INTSIZE               1
> 
> 

On Tue, May 01, 2007 at 04:41:57PM -0700, [EMAIL PROTECTED] wrote:

> +                if (STRING_IS_NULL(src_name) || STRING_IS_EMPTY(src_name)) {

> +                if (STRING_IS_NULL(dest_name) || STRING_IS_EMPTY(dest_name)) 
> {

> +                if (STRING_IS_NULL(name) || STRING_IS_EMPTY(name)) {


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() ?

Although, visually it's distracting, and it's still about as much typing as
the macros' contents.

Nicholas Clark

Reply via email to