元编程在大型计算机编程中有许多用途。
Metaprogramming has many uses in large-scale computer programming.
除了框架,元编程还能够帮助测试。
Besides frameworks, metaprogramming is also helpful in testing.
元编程、程序员和领域专家。
元编程通常能提供更加简洁的解决方案。
Metaprogramming often provides much cleaner solutions to problems.
可以看到,元编程提供了极好的灵活性。
As you can see, metaprogramming is all about extreme flexibility.
其实,我平常大多数时候都把元编程应用在写测试上面。
In fact, most of the time that I use metaprogramming on a daily basis is when I'm writing tests.
通常,大部分代码都可以使用元编程工具来实现这个任务。
Often, most of the code can use the metaprogramming tools available to accomplish the task.
最好的系统可以让您在元编程系统本身内部就可以进行多级抽象。
The best systems are those that allow you to work at multiple levels of abstraction within the metaprogramming system itself.
使用Ruby反射和元编程的组合,表的列可以变成对象的属性。
Using a combination of Ruby reflection and metaprogramming, the columns of the table become properties of the object.
如果你的元编程需要eval,那它也必须遵循相同的要求。
If your metaprogramming requires eval, it's subject to the same requirements.
虽然企业元编程同样涉及这些问题,但是它们还增加了其他一些考虑。
Enterprise metaprogramming involves these as well, but also adds other considerations.
但Searchable插件也可以在您个人的域类上做一些元编程。
But the Searchable plug-in also does a bit of metaprogramming on your individual domain classes.
由于这个原因,元编程系统应该可以进行定制,从而为各种系统产生输出。
Because of this, the metaprogramming system should be customizable to produce output for a wide variety of systems.
你也可以使用元编程(metaprogramming)技术。
元编程提供了快速、简单的方法,使潜在的随机行为具有了必然性。
Metaprogramming offers a quick and easy way to make potentially random behavior deterministic. For example, Listing 10 demonstrates overriding the static random method of the Math class.
然后我们介绍了几种元编程系统,并给出了几个使用这些系统的例子。
We then looked at several metaprogramming systems and examples of their use.
在一种动态类型语言中,使用元编程特性来实现高级设计经常是必要的。
In a dynamically typed language, it is often necessary to use metaprogramming features to implement advanced designs.
元编程框架经常需要支持一些外部决策,例如决定哪个列或内部字段对用户重要。
Often, metaprogramming frameworks need to allow aesthetic decisions, such as deciding which columns or internal fields are important for the users.
它使用元编程来生成视图模型,使你能够绑定至你在控制器中定义的对象。
It USES metaprogramming to generate the view model and allow you to bind to the objects you define in your controller.
但是,这次失败并不是因为域类上缺少元编程,而是因为缺少依赖性注入。
This time, however, the failure isn't due to the lack of metaprogramming on a domain class. It's due to the lack of dependency injection.
因为可以在数据结构中包含函数,所以函数性语言构成了元编程的优秀平台。
Because you can include functions in the data structures, functional languages make excellent platforms for metaprogramming.
元编程十分强大,但是使用它需要经验,而且会导致代码变得难以理解,维护和调试。
While metaprogramming is powerful, using it well takes experience and the resulting code tends to be hard to understand, maintain, and debug.
这样一来元编程就没有任何作用了,因为这些修改必须在更低的层次上进行。
The metaprogram is no longer of any use because the change must be made at a lower level.
许多Rails模型对象之所以简单,是因为属性都是用元编程动态添加的。
Many Rails model objects are simple because the attributes are all added dynamically with metaprogramming.
第2部分将进一步深入Streamlined的元编程模型及其定制特性。
Part 2 will delve more deeply into Streamlined's metaprogramming model and customization features.
当我开始用Ruby编写代码时,我受到的最大改变是产生和使用元编程结构的能力。
The big thing that changed for me when I started coding in Ruby is my ability to produce and consume metaprogramming constructs.
这种思想起源于传统的元编程,但是通过使用平台无关模型已经超越了传统的方法。
It is rooted in a strong tradition of metaprogramming and yet goes beyond traditional methods using its concept of platform-independent models.
可以用真正的元编程或代码生成来创建视图,视图可能需要修改,也可能不需要修改。
You can create views, which you may or may not need to modify, with true metaprogramming or code generation.
动态类型支持所有高级的元编程技巧,这在强类型语言中是很难实现的,甚至不可能。
Dynamic typing allows all sorts of advanced meta-programming tricks that are difficult or impossible in a strongly typed language.
应用推荐