Thomas F. Burdick <tfb@conquest.OCF.Berkeley.EDU> wrote:
+---------------
| Barry Margolin <barmar@alum.mit.edu> writes:
| > Jeff Cunningham <jeffrey@cunningham.net> wrote:
| > > I'm sitting here working on a cgi script - in Perl, because the server
| > > it lives on doesn't have Lisp. And I just realized that for sometime
| > > now all my Perl code has started looking like Lisp. I mean both the
| > > indentation, the way I'm piling up ')' and '}' at the end of lines, ...
| >
| > I suggest this is a bad idea. When you're writing in Perl, you'll
| > probably be better off in the long run if you adopt the Perl community's
| > coding styles.
|
| Writing Perl that superficially "looks like" Lisp is a terrible idea,
| and I would hate to inherit such a codebase, even more than I
| would some random Perl codebase.
|
| But there are plenty of deeper lessons you can take with you from Lisp
| that will make your Perl code nicer. Using higher-order functions,
| for example, semi-functional style, anonymous functions and call-with-
| idioms, and dynamic binding.
+---------------
The lesson from Lisp that has given me the most insight into Perl
was the realization, while reading Sriram Srinivasan's "Advanced
Perl Programming", that Perl's "globs" are almost identical to
"fat" Lisp symbols! ;-} And then all the line-noise started
making sense as simply the various "accessors": ;-} ;-}
*foo == 'foo
$foo == (symbol-value 'foo)
@foo == (symbol-array-value 'foo)
%foo == (symbol-hash-value 'foo)
&foo == (symbol-function 'foo)
FOO == (symbol-stream-value 'foo)
\$foo == (locative (symbol-value 'foo))
O.k., it's not quite that simple, but I do find it a helpful approximation...
-Rob
-----
Rob Warnock <rpw3@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607