c++ - 我应该使用 Perl 的哪些动态编程特性?

标签 c++ c perl

我对 scipting 语言(尤其是 Perl)还很陌生,而且我编写的大部分代码都是无意识地将 C 代码转换为 Perl 的努力。

Reading about Perl, one of the things that is often mentioned as the biggest difference is that Perl is a dynamic language. So, it can do stuff at runtime that the other languages (static ones) can only do at compiletime, and so be better at it because it can have access to realtime information.

一切都好,但是在使用 Perl 编写代码以使用它所具有的所有动态编程特性来生成一些很棒的代码时,我应该在 C 和 C++ 方面有一些经验,并牢记哪些特定特性?

最佳答案

这个问题足以填满一本书。事实上,事情就是这样发生的!

Mark Jason Dominus 的优秀高阶 Perl 是 available online免费。

当我第一次读这本书时,这是它的序言中的一段话,真的捕获了我的喉咙:

Around 1993 I started reading books about Lisp, and I discovered something important: Perl is much more like Lisp than it is like C. If you pick up a good book about Lisp, there will be a section that describes Lisp’s good features. For example, the book Paradigms of Artificial Intelligence Programming, by Peter Norvig, includes a section titled What Makes Lisp Different? that describes seven features of Lisp. Perl shares six of these features; C shares none of them. These are big, important features, features like first-class functions, dynamic access to the symbol table, and automatic storage management.

关于c++ - 我应该使用 Perl 的哪些动态编程特性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3622322/

相关文章:

linux - 在 Perl 中将内存大小(人类可读)转换为实际数字(字节)

c++ - 此 C++ 代码包含哪些未定义的行为

c++ - C++ 在多大程度上是一种静态类型语言?

c - 使用 nop 程序集精确延迟 Arduino?

c++ - 真等于1,假等于0吗?

Perl 脚本 - 在 @INC 中找不到 Net/SSH/Perl.pm

c++ - union 中出现意外结果 (C++)

c++ - 显然,静态变量将其值重置为 0

c++ - 指针减法和替代方案

regex - 如何让我的程序将第一行视为 'special'