Debian Codegraph @

helper/PerlPythonNotes

raw
1
2 Debram emphasizes compiled over interpreted software.
3 The difference in emphasis is seen most clearly with
4 respect to software written in Perl, but it is seen to a
5 lesser degree too with respect to software written in
6 Python and other languages. Although the purpose of the
7 emphasis is to enhance Debram's usefulness to its target
8 audience as explained below, the emphasis has the side
9 effect of implying---intentionally or
10 unintentionally---that some free software is better than
11 others.
12
13 Few, of course, would dispute the abstract principle
14 that some free software is indeed better than others
15 (more useful, more efficient, more reliable, more wisely
16 designed, pleasanter to run, easier to customize, better
17 documented, etc). Software can be outclassed without
18 dishonor to its developer. Nor will users always agree
19 among themselves as to which software outclasses which.
20 While Debram's primary purpose is to ramify not to rate
21 software, it is neither practical nor desirable to
22 ramify all software with equal prominence. If it is
23 felt that `sudo' is more important than `lockvc', `make'
24 more important than `fortune-mod', `coreutils' more
25 important than `m4-doc', then the ramification should
26 and does reflect this. Such reflection necessarily
27 involves judgment.
28
29 What is unfortunate is that even necessary, useful,
30 respectful judgment can offend good people who have a
31 stake in the thing judged. Because the people in
32 question here are my friends and fellow Debian
33 Developers, the matter matters a lot to me. Since I do
34 not know how to design a useful Debian ramification
35 which judges nothing, a decent respect for the opinion
36 of my Debian colleagues demands that I explain at least
37 why Debram judges the way it does. This document
38 explains. Read, and see if you don't agree.
39
40 THE BASIC DILEMMA
41
42 As observed, Debram's principal purpose is to ramify or
43 classify software according to function or area of
44 interest. Nevertheless, an inherent tension arises
45 between the need to ramify Debian's archive sufficiently
46 finely that a given branch is not too large, and the
47 need not to ramify the archive into such a large number
48 of branches that a user cannot even find the branch he
49 wants. Now it is true: some large branches yet lack
50 subramification only because my own time, knowledge
51 and/or interest are limited, and because no other
52 appropriate person has yet stepped forward to do the
53 work: [7880 CJK (Chinese/Japanese/Korean)] is a good
54 example of this effect. Imprecisely but more generally,
55 however, the parts of the ramification where the more
56 important packages reside are the ones which tend to be
57 ramified more finely. Thus the `tree' package
58 resides (at the time of this writing) in [1112 File
59 Listing and Finding] with only three other packages,
60 while `bochs-sdl' crowds into [9620 SDL] with sixty-one
61 others. The premise: the user's time is limited and
62 Debram probably serves him better by making him first
63 aware of the existence of `tree'. Hence the principle:
64 the more important kinds of packages get smaller
65 branches.
66
67 This is not to claim that every package in a small
68 branch is equally important. Far from it. For one
69 thing, I as ramifier am not an expert in all areas of
70 the Debian archive; unless you have taken the trouble to
71 inform me, sometimes I do not know which packages are
72 important. For another, one does not subdivide an
73 already adequately small branch just because it contains
74 one or two particularly important packages. But broadly
75 the principle holds: the more important kinds of
76 packages do tend to get smaller branches.
77
78 Branches are kept small in two ways: promotion and
79 subramification. Subramification---the division of a
80 large branch into two or more smaller branches---is
81 best where a branch has many packages of roughly similar
82 importance, where a natural fault divides the packages
83 into roughly equal groups. Promotion---the separation
84 of a few prominent packages from the general
85 body---applies in other cases and takes many forms.
86 Both subramification and promotion involve judgment, of
87 course; but only the latter immediately elevates some
88 packages above others.
89
90 Now, some might argue that Debram should not be in the
91 business of elevating packages; but I would respond that
92 elements of the Debian Project have long been in the
93 business of elevating some packages above others:
94 witness the "standard" and "optional" package
95 priorities. Nowhere is it written that only Debian's
96 FTP-master should render such editorial judgment. The
97 trouble with the "optional" priority is not that it
98 differentiates, but rather that it includes most of the
99 archive and hence does not differentiate well enough.
100 Consider: Would Debram serve its users better if it hid
101 the fact that Apache is more significant than most of
102 the other web servers, that Bind is more significant
103 than most of the other name servers, that Linux is more
104 significant than most of the other kernels? Would
105 Debram serve its users better if it denied the
106 historically rooted importance of Groff and Vi?
107 Although it is Debram's duty (with perhaps a handful of
108 exceptions) to treat every Debian package with dignity,
109 it is not and cannot be Debram's task to make all
110 packages equal. The dilemma arises not in the principle
111 that packages are unequal, but in the practical fact
112 that some fallible person---I, in this case---must
113 render decisions thereto, decisions with which not
114 everyone will agree.
115
116 Now of course, not everyone need agree. I am not some
117 powerful FTP-master; I am a very ordinary Debian
118 Developer who ramifies packages to help interested
119 Debian users to find the software they need. When a
120 maintainer objects to a decision I make, I hope that he
121 discusses the matter with me, but in the final analysis
122 I have no power to prevent anyone who dislikes Debram
123 from simply ignoring the thing. Personally, I think
124 that Debram is neat. I think that you should use it.
125 Maybe you agree. If you have some comments, or even
126 better a patch, I'd like to hear from you.
127
128 THE BIG FIVE PROGRAMMING LANGUAGES
129
130 In the free-software world, it may be said that the big
131 five programming languages are C, C++, Shell (Bourne or
132 Bash), Python and Perl---with Assembly possibly added to
133 the list as a sixth, depending on your point of view.
134 Other popular languages there are, of course, and much
135 good free software is developed in them: Fortran 77,
136 Objective C, Tcl/Tk, OCaml, Haskell, Octave, Common
137 Lisp, Elisp, Scheme, Guile, Java, Lua, PHP, Ruby, Ada
138 and others. However, if one had to draw up a list of
139 the chief languages at the present time, the list could
140 hardly differ much from the big five named here.
141
142 Of the big five, Debram treats software written in
143 Python and especially in Perl somewhat differently from
144 the others. For this, some explanation is in order.
145 Perl presents the clearer case and happens to be the
146 more familiar personally to me, so let us speak of Perl
147 first.
148
149 PERL
150
151 From the Perl manpages:
152
153 Perl is a high-level ... general-purpose
154 programming language ... intended to be
155 practical ... rather than beautiful...
156
157 Perl is frequently ... an interpreted
158 language...
159
160 And referring my words here and other expressions like
161 them,
162
163 [Perl's originator Larry Wall] doesn't really
164 care [whether one calls it] a Perl program or a
165 Perl script...
166
167 Now that "script" and "scripting" are terms that
168 have been seized by unscrupulous or unknowing
169 marketeers for their own nefarious purposes,
170 they have begun to take on strange and often
171 pejorative meanings, like "non serious" or "not
172 real programming". Consequently, some Perl
173 programmers prefer to avoid them altogether.
174
175 One can hardly blame the creators of Perl for promoting
176 their own programming language, but who are
177 the "marketeers" here, eh? Ramifying Debian software
178 not promoting Perl is my task, and although it is
179 possible to write almost any program in Perl, a broad
180 gulf yawns between the attitude with which one typically
181 approaches programming in Perl and the one with which
182 one approaches programming in C++. Perl cannot be all
183 things to all people. The words "script"
184 and "scripting" have always connoted "non-serious"
185 and "not real programming" in some sense---this is
186 nothing new---but the words are not pejorative until
187 applied to a programmer trying to use a scripting
188 language for serious purposes for which the language is
189 fundamentally ill suited. The whole point of Perl is to
190 support the "non-serious" programmer who does not want
191 to do "real programming" at the moment. If not for
192 this, then what need was there for Perl in the first
193 place? We already had adequate programming languages
194 for the serious jobs.
195
196 And there is the rub. The creators of Perl and their
197 good battalions on CPAN believe fundamentally in the
198 Perl way and have devoted tens of thousands of hours to
199 adding to Perl the features needed to make it a real,
200 serious programming language. Their tenacity is
201 commendable. However, the fact that the Perl people
202 have set improbably lofty goals for their "practical
203 rather than beautiful" language, the fact that they have
204 been busy as beavers working toward these goals, may
205 command our respect; but it cannot require you and me to
206 agree that they have succeeded. My view is that they
207 have not succeeded, and furthermore that the kind of
208 success they seek is probably unattainable. The old
209 Perl camel just isn't that kind of beast.
210
211 PERL AND STROUSTRUP'S "TWO RELATED PURPOSES"
212
213 As Bjarne Stroustrup wrote in his non-free book *The C++
214 Programming Language* (special ed, 2000),
215
216 A programming language serves two related
217 purposes: it provides a vehicle for the
218 programmer to specify actions to be executed,
219 and it provides a set of concepts for the
220 programmer to use when thinking about what can
221 be done...
222
223 The connection between the language in which we
224 think/program and the problems and solutions we
225 can imagine is very close.
226
227 If Stroustrup is right, then how does Perl serve
228 the "two related purposes?" With respect to providing a
229 vehicle for the programmer to specify actions to be
230 executed, consider that there is no clear distinction in
231 Perl between the integer 0, the floating-point 0.0, the
232 string "0", the character '0', and the logical
233 value *false*. This is by design. However, in
234 Perl "00" *is* something different: it is
235 logically *true* and increments magically not to 1 but
236 to "01". Perl evinces such semantically quirky behavior
237 in many ways. Another example is that
238
239 open FILE, $file;
240
241 behaves differently if $file is "foo" or "!foo" than
242 if ">foo". (Who would name a file "!foo" or ">foo"?
243 Probably no one, but that isn't the point. In the old
244 Perl ethic, though, that is indeed the point. This is
245 where the Perl people and I disagree.) Modern Perl does
246 provide you ways to work around most of the semantical
247 quirks---for example, you can code
248
249 $x += 0;
250 open FILE, '<', $file;
251
252 to ensure that the value of $x is "0" not "00" and that
253 the file is opened properly for reading not
254 writing---but such worked-around Perl is awkward at
255 best: it defeats Perl's own natural-linguistic
256 strengths, while scattering random-looking symbols,
257 terms, arguments and statements about the code whose
258 only purpose is to persuade Perl not to behave
259 illogically.
260
261 With respect to providing a set of concepts for the
262 programmer to use when thinking about what can be done,
263 Perl has made at least two important contributions. The
264 first is in the unnamed $_ "it" variable, which C++
265 admittedly lacks. The second is in the Perl-compatible
266 regular expression (PCRE), which one can now access from
267 any language via Libpcre but which is still most
268 conveniently available in Perl. In general, however,
269 Perl's focus is on human linguistics rather than on
270 computational concepts---which is brilliant when it
271 works (usually in short scripts) but which leads the
272 programmer to do silly things when it doesn't. As
273 Stroustrup observes,
274
275 A [programming] language is said to *support* a
276 style of programming if it provides facilities
277 that make it convenient (reasonably easy, safe,
278 and efficient) to use that style. A language
279 does not support a technique if it takes
280 exceptional effort or skill to write such
281 programs: it merely *enables* the technique to
282 be used.
283
284 Stroustrup was talking primarily about Fortran 77 and C,
285 but his comments apply equally well to Perl. One can
286 indeed write tight, efficient, well organized, logical,
287 reliable code in Perl with sufficient effort. But is
288 it "reasonably easy, safe, and efficient" to do so? Or
289 to is it more like eating soup with a fork?
290
291 PERL AND STROUSTRUP'S CRITERIA
292
293 Stroustrup continues:
294
295 One language is not necessarily better than
296 another because it possesses a feature the other
297 does not. There are many examples to the
298 contrary. The important issue is not so much
299 what features a language possesses, but that the
300 features it does possess are sufficient to
301 support the desired programming styles in the
302 desired application areas:
303
304 [1] All features must be cleanly and elegantly
305 integrated into the language.
306
307 [2] It must be possible to use features in
308 combination to achieve solutions that would
309 otherwise require extra, separate features.
310
311 [3] There should be as few spurious
312 and "special-purpose" features as possible.
313
314 [4] A feature's implementation should not impose
315 significant overheads on programs that do not
316 require it.
317
318 [5] A [programmer] should need to know only
319 about the subset of the language explicitly used
320 to write a program.
321
322 Of these five criteria, Perl generally satisfies the
323 fifth and trivially the second. The third, the language
324 explicitly rejects. The first is a hopeless case for
325 Perl if you are doing much of anything other than text
326 processing. Regarding the fourth, the interpreter's
327 internal algorithms do seem to be pretty efficient, but
328 whatever overhead they do impose, the programmer is
329 stuck with. C++ and Python equal or beat Perl on all
330 five points.
331
332 These are not deficiencies of Perl. On the contrary.
333 None of the big five programming languages beats Perl at
334 what Perl best: quick, one-man, one-off text processing
335 scripts. One might add to Stroustrup's list that
336
337 [6] Features supporting the most common
338 programming tasks---text, list, hash and file
339 processing---should be cleanly and elegantly
340 integrated into the language.
341
342 [7] The language should make it as easy as
343 possible for the programmer to code simple,
344 practical jobs.
345
346 [8] The grammar and syntax of the language
347 should deeply resemble natural language where
348 possible. (Whether this last point is actually
349 a virtue is a matter for another discussion, but
350 to Perl programmers it is a virtue, so for
351 purpose of the present discussion we shall treat
352 it as such.)
353
354 Perl wins on these points. Notice, however, how the
355 focus of the points has changed. The first four of
356 Stroustrup's original five points mostly regard the
357 disciplined creation of solid, well built software. By
358 contrast, the three Perl points I have added mostly
359 regard the immediate personal convenience of the lone
360 programmer. There is nothing wrong with conveniencing
361 the programmer; but if solid, well built software for
362 public distribution is what we seek, then it is
363 Stroustrup's five points that we primarily should attend
364 to.
365
366 DATA TYPES AND DEBUGGABLITY
367
368 Although debuggability is a partial or implicit aim of
369 several of the eight criteria, it is not the explicit
370 target of any of them. The importance of debuggability
371 in a programming language is hard to overstate, so one
372 might further add to the criteria that
373
374 [9] The language must be inherently neat. It
375 must deeply integrate and conveniently make
376 available facilites for the programmer to
377 discipline himself and his code---facilities
378 which, when applied, permit the compiler to warn
379 the programmer swiftly and accurately of as many
380 bugs as possible. Strict data typing is a
381 typical example of such a facility.
382
383 If this is indeed a goal, then it is a goal the old
384 Perl camel stampedes away from not toward. Yet have
385 facilities not been grafted onto Perl to ameliorate
386 the problem? Yes, they have, many times, often by
387 heroic efforts. Many efforts have been made to tame
388 the camel. But such facilities and efforts,
389 although helpful indeed to the Perl programmer,
390 nevertheless cut against Perl's basic nature. As
391 Stroustrup writes,
392
393 Over the basic type system of a language, only
394 Pyrrhic victories are possible.
395
396 PERL AND DEBRAM
397
398 Now, none of this would be at issue if Perl did not
399 enjoy loyal battalions of good-natured, enthusiastic
400 supporters who believe strongly in Perl's destiny as a
401 top-tier, world-class general-purpose programming
402 language. If programming languages were eating
403 utensils, then I happen to think that Perl is a fork,
404 and if they agreed with me that Perl is a fork, then we
405 would all agree that Perl is the best fork around and we
406 would not be having this discussion. The problem from
407 my point of view is that Perl's promoters feel that Perl
408 is a pretty good spoon, too. I respect their point of
409 view, but having personally written more lines of code
410 in Perl in my life than in any other programming
411 language, I disagree. To me, Perl's spoon is like the
412 little spoon you flip out of a Swiss army knife: better
413 than nothing in a pinch, but hardly a substitute for a
414 real spoon when you are sitting in your kitchen and have
415 a bowl of soup to eat.
416
417 So if Perl is no spoon, then what are we to make of the
418 observation that one can compile Perl scripts? Answer:
419 the observation may be technically correct---the
420 existence of a working Perl compiler may be a
421 significant achievement in itself---but to introduce the
422 fact in the present context fundamentally distorts the
423 point. Compiling a script directly into machine
424 code (or byte code, or whatever), with special
425 supporting libraries, doesn't make it less of a script;
426 it just makes the script unreadable and a little faster.
427 Anyone who has written serious programs in C or C++
428 knows the difference.
429
430 Still, a fair bit of significant software is indeed
431 written in Perl, and although I admittedly have my
432 doubts, it is not for me to say that Perl was or was not
433 the right language for the developers to choose for a
434 given software project. However, if you want to spin
435 off some little betaware prototype fast, none of the big
436 five suits the need quite like Perl. Browse
437 through [3681 General Perl Software] in the ramification
438 and you'll see what I mean. While there is undoubtedly
439 some good software in there, there is also a lot of
440 subpar betaware---and in any case it is hard to escape
441 the prejudice, or at least the predisposition, that Perl
442 is for prototyping and that if the software were really
443 serious, it would have been rewritten in C++ or the
444 like. Put another way, some programmers go to a lot of
445 trouble to rewrite in C++ software originally prototyped
446 in a scripting language like Perl. This, they do for a
447 reason. Software thus rewritten merits a presumption of
448 extra distinction.
449
450 For these reasons, Debram's presumption is in favor of a
451 program written in a strongly typed, logically coherent,
452 normally machine-code compiled language like C++. Where
453 Perl software does an important job for which no
454 comparable C/C++ software is available or where it has
455 significant, long-established stature, and where I am
456 aware of the fact, Debram does ramify the Perl software
457 in the main ramification normally, according to its
458 function rather than to its implementation language. In
459 some branches of the ramification like [1360 XML/SGML],
460 [1444 R Statistics], [1752 MySQL] and [8672 Apache],
461 where a strong Perl tradition exists, the relevant Perl
462 modules and software are indeed included. In the
463 interest of keeping the rest of the ramification
464 uncluttered, however, most other Perl software is kept
465 together under [3680 Perl Software].
466
467 PYTHON AND OTHER PROGRAMMING LANGUAGES
468
469 Turning from Perl to Python, the case for Python is
470 rather different. Python is a different kind of
471 language, to which most of the objections above do not
472 apply. However, partly because Python is interpreted,
473 partly for consistency with the Perl policy, partly
474 because one suspects that really serious Python software
475 is sometimes reimplemented in C++ anyway, partly because
476 the practice saves scarce Debram development hours, much
477 Python software nevertheless remains ramified
478 under [3590 Other Python Software].
479
480 A similar policy applies to the other interpreted
481 languages. However, there is much less free software
482 written in most of those. With regard to the occasional
483 software package written in Ada or some other alternate
484 compiled language, Debram generally takes an agnostic
485 view, ramifying it normally as though it were written
486 in C or C++.
487
488 CONCLUDING REMARKS
489
490 Some will agree with Debram's stance on Perl and Perl
491 software and some will undoubtedly disagree. Careful
492 inspectors of Debram's source will notice that several
493 of Debram's own development helper scripts are written
494 in Perl---and since I was the one who wrote those
495 scripts, it clearly cannot be that I think that Perl is
496 all bad.
497
498 However, it is also true that I retain some doubts about
499 Perl's suitability for real programming, and that my own
500 long experience coding in Perl has deepened rather than
501 mollified such doubts. Some say that the language a
502 program is written in is a mere implementation detail,
503 but I don't believe it. If undisciplined programming
504 languages didn't lead to undisciplined programs, then
505 how could we explain the success of C++ and Python?
506 Indeed, how could we explain the existence and broad use
507 of Perl's own "use strict" pragma? As the native
508 speaker of Greek or French would agree, language
509 discipline counts.
510
511 More than this, though, it is the experience of wading
512 through the Debian archive, package by package, which
513 has impressed me of the general difference in character
514 between scripted software and compiled
515 software---particularly between software scripted in
516 Perl and software compiled from C or C++. As in the
517 case of Cdebconf, really serious Perl scripts tend
518 eventually to be reimplemented into the more serious
519 programming languages. For this, there is a reason.
520
521 My intent in writing this document has not been so much
522 to convert Perl enthusiasts to my point of view. (For
523 one thing, I *am* a Perl enthusiast. Only, my
524 enthusiasm for Perl attenuates rapidly outside Perl's
525 proper application domain.) My intent in writing these
526 words has been to try to explain to Perl enthusiasts who
527 disagree with me why I have made the ramification design
528 decisions I have made, in the hopes that even if these
529 people do not wholly agree, they will nevertheless
530 understand, appreciate and respect Debram's point of
531 view in the matter.
532
533 Debram's Python policy, of course, I have not really
534 explained here. In fact I admit that I have not put
535 nearly so much thought into the matter, in part because
536 I personally have limited experience coding in Python.
537 Debram policy-wise, Python is sort of "along for the
538 ride" with Perl: the present Python policy is not so
539 much by thoughtful design as it is by mere analogy.
540 Scripts are usually relatively slow. That is about as
541 far as my Python analysis has gone. (In actual
542 ramification practice, I would observe that for some
543 reason Python software does not usually seem to pose
544 quite the same dilemma Perl software does. Is this
545 because Python programmers are more likely voluntarily
546 to have recoded important software when appropriate
547 in C++? I can't really say. There is the fact that
548 some Python developers proudly name their own
549 programs "pyfoo" or "pybar". If they view their
550 software's Pythonity as a special mark of distinction,
551 then it is hardly for me to question the view! Maybe it
552 really is a special mark. Python is a fine language.)
553
554 One last remark. Although I believe Debram's Perl
555 policy to be the right one generally, I also acknowledge
556 that it does not suit all Perl programs equally. If you
557 maintain a specific Perl, Python or other scripted
558 package which you feel has established first-tier
559 stature and deserves to be ramified out in the main
560 ramification, let me know. I am not some secret judge
561 wearing a black hood in a hidden chamber; I am just
562 some guy trying to make sense of the vast heap of
563 packages which constitutes the Debian archive. If
564 Debram misramifies your package---Perl package or
565 otherwise---contact me: we would see what we
566 couldn't do about moving it.
567
568 Thank you for maintaining all that great free software.
569
570 --------------------------------------------------------
571 Thaddeus H. Black, 9 January 2006
572