Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Dikini.net:
Poor man's macro programming in php (revisited)
Aug 01, 2006 @ 11:16:38

In refernece to his previous post on macro programming in PHP, vlado is back with this new post answering the question "How exactly can you do macros in php now?"

Macros have (let's say) two main responsibilities - adding syntactic sugar and abstraction of common patterns. The syntactic sugar bit is something which probably should happen at compile time, at least in a weakly typed language like php. So I'll skip them. The abstraction of computation, well this is wat codified design patterns are.

He illustrates what a macro might look like, using the generic functions and partial evaluation patterns to accomplish it. He also shows it being possible with something built around a create_function call.

So what do these example prove? Well, php has decent abstraction mechanisms. The fact that we can do indirect function calls and indirect variable (symbol) resolution can give us useful means to code in different design patterns. How can we make proper macros? Is it too complicated to have something like dylan macros (a nice paper from 1999)
tagged: macro programming design patterns revisited macro programming design patterns revisited

Link:

Dikini.net:
Poor man's macro programming in php (revisited)
Aug 01, 2006 @ 11:16:38

In refernece to his previous post on macro programming in PHP, vlado is back with this new post answering the question "How exactly can you do macros in php now?"

Macros have (let's say) two main responsibilities - adding syntactic sugar and abstraction of common patterns. The syntactic sugar bit is something which probably should happen at compile time, at least in a weakly typed language like php. So I'll skip them. The abstraction of computation, well this is wat codified design patterns are.

He illustrates what a macro might look like, using the generic functions and partial evaluation patterns to accomplish it. He also shows it being possible with something built around a create_function call.

So what do these example prove? Well, php has decent abstraction mechanisms. The fact that we can do indirect function calls and indirect variable (symbol) resolution can give us useful means to code in different design patterns. How can we make proper macros? Is it too complicated to have something like dylan macros (a nice paper from 1999)
tagged: macro programming design patterns revisited macro programming design patterns revisited

Link:


Trending Topics: