Greenspun 10th rule in Perl?

Greenspun Tenth Rule of Programming is a common aphorism in programming and especially in programming language circles. It states:

Any fairly complex C or Fortran program contains a special, informal, error-limited, slow implementation of half of Common Lisp.

Questions:

  • Do you think this is true for the Perl interpreter? Only objective arguments (for example, which Common Lisp functions are implemented in the interpreter)

  • Regardless of whether there is Lisp (or at least a special, informally defined error, a slow implementation of half of Common Lisp), fully implemented in Perl?

+4
source share
5 answers

You might like the preface (as well as the rest of the book) for a higher order Mark Jason Dominus Perl , the subject of which is your question. He says:

If you take a good book about Lisp, a section will appear that describes Lisp good functions. For example, Peter Norwig’s book “Artificial Intelligence Programming Paradigms” includes a section entitled “What makes Lisp different”? which describes the seven functions of Lisp. Perl shares six of these functions; ...

Mark has many other things to say about Lisp and Perl.

So, Perl is already Lisp, practically, but I would say that it is neither slow nor half. However, one of the reasons Mark points out the difference between Perl and Lisp is because Perlers deals with unstructured strings (in general), while Lispers deals with structured data whenever possible. Perl can do this, but Perlers usually do not.

+21
source

The problem with this aphorism is that he does not say very much. General Lisp is so complex and versatile that it implements almost any function that a programming language can have. Thus, all this really suggests that any fairly complex system contains half of all possible possibilities.

And yes, Perl is quite complex.

+2
source

I will leave aside the “slow” and “tricked” parts because they are mostly cheap shots. Nothing interferes with the deliberate, officially established implementation of all Common Lisp due to slowness or error.

As for the rest, I think this tends to be true, but the big reason it is true is that Common Lisp provides quite a lot, and C provides very little. Real elements, such as hash tables, linked lists, and extensible vectors, remain at the disposal of the user for implementation. All memory management is manual, but you can automate it by recounting or even adding a garbage collector. You can collapse your own polymorphic OO by pointing to pointers to objects in the structure somewhere and using it as a vtable. You can add a translator for a language that will allow you to easily script your application, or facilitate interaction and testing at runtime.

This is almost half of Common Lisp; Perl really provides all of this and some other Lispy features for download. But in fact, it doesn't look like a big deal, because one thing that has changed over the 15 years since Greenspoon came up with his tenth law (skipping the other nine) is that many languages ​​added the same half Common lisp Guy Steele said about Java a few years later --- he dragged programmers halfway to Lisp.

+1
source
+1
source

Github has a small project called "mini_scheme". This is a small, buggy, and incomplete mixture of Schema and Common Lisp. So, your "special, informal, error-limited, slow implementation of half of Common Lisp" (or schema) in Perl.

+1
source

Source: https://habr.com/ru/post/1305705/


All Articles