Reply to Re: Macros in php

Your name:

Reply:


Posted by Tim Martin on 04/10/06 11:40

Jerry Stuckle wrote:
> Tim Martin wrote:
>> Jerry Stuckle wrote:
>>
>>> Tim Martin wrote:
>>>
>>>> Used judiciously these sorts of techniques can open up all sorts of
>>>> possibilities (I've seen generic type containers implemented in pure
>>>> C using macros), but the general consensus is that the potential for
>>>> misuse is far too great and modern language constructs have obviated
>>>> all the genuine needs for such techniques.
>>>>
>>>
>>> What "General consensus"? I haven't heard that.
>>
>> For example, Sutter / Alexandrescu, "C++ Coding standards". They
>> dismiss macros in no uncertain terms. You could argue about quite how
>> widely accepted this viewpoint is (not that I have any interest in
>> such an argument).
>
> That's hardly a "general consensus".

I quoted that as one example. As I say, I don't have any particular
interest in arguing over how widely shared this opinion is. I'll gladly
modify my original statement to "some people believe that..." if it
makes you happier.

> It's also about C/C++, not PHP.

My original comment was about usage of macros in languages that have
them (i.e. C and C++), so this is an appropriate example. I'm obviously
not going to find any coding standards that forbid using macros in PHP.

For what it's worth, I've spent a lot of time writing C and I've used
macros extensively. When used properly I believe they can make code much
easier to maintain. However, I haven't found the same need in PHP.

> The potential benefits of having them are that they can make coding more
> understandable and easier to maintain.

So you say. I'm yet to see any real examples of situations in PHP where
macros give a significant benefit and similar behaviour couldn't be
achieved either by using an existing language construct, or by making a
small but less significant change to the language.

Tim

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация