CSC/ECE 517 Fall 2010/ch4 4g km

From Expertiza_Wiki
Jump to navigation Jump to search

Metaprogramming in dynamically typed languages


Introduction

In the previous article for which the link does not exist yet, we learn that command patterns in static and dynamic languages provide separation of objects that request actions from the objects that ultimately perform actions. This is performed by encapsulating the request for an action on a specific object. These command patterns are executed at runtime and simply had the fact that another program is being called. Another technique of encapsulating behavior is for the program to have changes initiated at compile time. This type of design requires that the program not only can call another piece of code at runtime but it can build these calls at compile time via metaprogramming. Metaprogramming is the ability for a computer program to manipulate itself or other programs at the time of compilation as opposed to performing this manipulations at runtime. This tends to allow for greater flexibility for a program to handle new situations.

Example of Metaprogramming

Dynamic Programming Languages

http://en.wikipedia.org/wiki/Dynamic_programming_language

Conclusion

What’s Next?

In the next article for which the link does not exist yet, we will look at static-analysis tools for Ruby.

References

  1. Metaprogramming on Wikipedia
  2. Dynamic Programming Languages on Wikipedia
  3. Command Pattern on Wikipedia