home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / unix / shell / 3774 < prev    next >
Encoding:
Text File  |  1992-09-02  |  6.1 KB  |  103 lines

  1. Newsgroups: comp.unix.shell
  2. Path: sparky!uunet!ftpbox!mothost!merlin.dev.cdx.mot.com!merlin.dev.cdx.mot.com!lezz
  3. From: lezz@merlin.dev.cdx.mot.com (Lezz Giles)
  4. Subject: Re: Shell Scripts vs. C programs
  5. Message-ID: <1992Sep2.145725.3158@merlin.dev.cdx.mot.com>
  6. Sender: news@merlin.dev.cdx.mot.com (USENET News System)
  7. Nntp-Posting-Host: fenric.dev.cdx.mot.com
  8. Reply-To: lezz@merlin.dev.cdx.mot.com (Lezz Giles)
  9. Organization: Motorola Codex, Canton, MA
  10. References: <1992Aug31.211738.1909@tjhsst.vak12ed.edu> <119@steiny.com> <FRIEDMAN.92Sep2045423@nutrimat.gnu.ai.mit.edu>
  11. Date: Wed, 2 Sep 1992 14:57:25 GMT
  12. Lines: 89
  13.  
  14. In article <FRIEDMAN.92Sep2045423@nutrimat.gnu.ai.mit.edu>, friedman@gnu.ai.mit.edu (Noah Friedman) writes:
  15. |>In article <1992Sep1.173604.15563@u.washington.edu> donn@carson.u.washington.edu (Donn Cave) writes:
  16. |>>language that would have "software engineering" features for writing large
  17. |>>systems.  For me, that would mean some level of typing, structured types,
  18. |>>functional scoping, and some way to deal with code in separate modules,
  19. |>>but I'm sure there's more to it if one were to consult some standard texts
  20. |>>on this issue.  Would be nice to be able to create somewhat complex data
  21. |>>types, e.g., trees, and store "pointers" to functions, but not necessarily
  22. |>>the way C does it, maybe more like Lisp.  
  23. |>
  24. |>   I've been thinking about this for awhile, especially since I started
  25. |>using perl.  Having a tool like perl is the right idea for typical unix
  26. |>applications, filters and so forth---fork is expensive and it's not going
  27. |>to get better any time soon (vfork is *still* better than a plain COW fork
  28. |>implementation), and exec is even worse---but perl's grammar and design is
  29. |>totally broken (sorry, Larry).  The reason why people complain about perl
  30. |>having the kitchen sink is that it has no uniform design; instead there is
  31. |>a grab bag of features that look hastily adopted from other programs like
  32. |>sed, awk, and grep, none of which are very orthogonal.  There are various
  33. |>annoying context-dependent misfeatures in perl as well, and
  34. |>multi-dimensional/nested arrays are cumbersome (the associate array
  35. |>features in awk are much easier to deal with).  Perl also suffers from
  36. |>being too redundant---there are tons of gratuitous looping constructs that
  37. |>give programmers lots of different ways to write the same thing and
  38. |>decrease readability without actually increasing the functionality of the
  39. |>language (using "unless" and violating the general condition->consequent
  40. |>order of expression is evil, especially since this is not a fundamental
  41. |>paradigm of the language).  The idea of function calls being lvalues I find
  42. |>to be unaesthetic as well.  Perl has lexical scoping, compilation, a
  43. |>package system for separating namespaces, and "modules" to its credit,
  44. |>however.  And it's actually powerful enough to do most of the things you
  45. |>could ever want in a single process, avoiding the aforementioned fork+exec
  46. |>overhead.  Perl as a general purpose interpreter is no worse than any other
  47. |>language interpreter, so I think most of the objections made by "unix
  48. |>purists" are off base.  They should not be complaining about perl's
  49. |>functionality; they should be complaining about its design.
  50.  
  51. I like perl for a similar reason to why I like English - I can express
  52. myself in many different ways and I get the freedom to choose the most
  53. concise and readable format.  I've used another language (an Algol
  54. derivative at the University of Edinburgh) that had both the "unless"
  55. and the "statement if condition" (and the "statement unless condition")
  56. constructs, so I don't regard these as particularly evil - they give
  57. me the opportunity to increase readability a lot.
  58.  
  59. A program is as readable as the author wants it to be and it is certainly
  60. easy to write unreadable programs in perl - but I'd contend that it is 
  61. difficult to find a language where you can write _readable_ code as
  62. concisely - particularly in a language which is available on so many
  63. platforms, which is one reason that it is so popular.
  64.  
  65. [description of Scheme-orientated languages paritally deleted...]
  66. |> ..................  And I think this would be more
  67. |>portable than using GNU Emacs' "unexec" method for dumping.
  68.  
  69. I once spent a lot of time and trouble getting a copy of undump for my
  70. particular architecture in an attempt to speed up a large (>2,500 lines)
  71. perl program - it turned out that the improvement in speed by using 
  72. undump was so negligable to be irrelevant.  The perl compilation phase
  73. is *fast*.
  74.  
  75. |>   You'd also want to write a library of commonly used subroutines to do
  76. |>various kinds of field splitting, pattern substitution, and so on.
  77. |>Although the way you actually do it is bletcherous, one of perl's selling
  78. |>points is that you can *quickly* write routines to get the job done.
  79. |>Unless you can do the same sorts of things with relative ease in a Scheme
  80. |>system, it won't be good enough to replace perl.
  81. |>
  82. |>   Scheme has latent types, rather than manifest ones (i.e. types are
  83. |>associated with values, not with variables).  Whether this is a good or bad
  84. |>thing is a religious issue that shouldn't be discussed in either of the
  85. |>newsgroups to which this is being posted, but just to throw some fuel on
  86. |>the fire, I prefer latent types for most applications.  :-)
  87.  
  88. Perl types do leave a lot to be desired - like Perl 5!  I have
  89. faith in Larry Wall to come up with something good in this area, but I hope
  90. that he isn't sticking to the old C/Algol/etc. model of types just because
  91. it's there - I hope he's considering other approaches.
  92.  
  93. I don't want to start a religious war - the points above are purely my
  94. own and I don't want to spend the next 200 years defending them to the death!
  95. If a better alternative to perl comes along then I'll think seriously about
  96. switching (though I've invested too much time in perl to make this decision
  97. lightly), but I like its design because (1) it gives me the flexibility to
  98. write my code as I want to, not as the language designer decided I should;
  99. (2) I can do just about anything I want to in fewer lines of code and in a
  100. more reliable way than in any other language.
  101.  
  102. Lezz "all hail to the Wall" Giles
  103.