Gentoo Archives: gentoo-dev

From: merv <merv@×××××××××××××.cy>
To: gentoo-dev@g.o
Subject: Re: [gentoo-dev] initscripts in python
Date: Thu, 17 Apr 2003 19:54:28
Message-Id: 3E9F3344.23068.F7F84A8@localhost
In Reply to: Re: [gentoo-dev] initscripts in python by Justin Whitney
1 Yep, I agree on your two cons:
2
3 ->a new interpreter would have to reach stable pretty quick since we
4 are mucking around with pretty system-vital stuff here (and since we
5 are using python syntax [in this hypothetical instance] to message to
6 the kernel, a new interpreter and a fairly fundamental re-write of the
7 shell may be the end result, though it might be politic not to revise what
8 was not necessary to revise)
9
10 ->the structure of the interpreter and ways in which it parse shell syntax
11 of a python dialect would have to be addressed with the aim of
12 minimising overhead on one-liner files, in particular (small scripts incur
13 overhead, unavoidably, at least conventionally, but lots of small
14 python-interpreted scripts might have real potential for runtime bloat)
15
16 About your two mitigating factors: indeed, python seems to be
17 evolving as a native gentoo language (perhaps this is a bit overstating
18 the point, given that python is built on C APIs, but consider that portage
19 is a central characteristic and feature of gentoo and that the portage
20 tree is a testimony to the practical usefulness and potential of python)
21 so to weave python or python-dialect syntax into a "system-boot
22 interpreter" would be a natural extension of its role in gentoo and, if
23 optimised for that purpose at that point, perhaps even a fast, efficient
24 and inexpensive alternative.
25
26 [Maybe it is worth saying at this point that I am trying very deliberately
27 to drive a line between python the language as it is and python-
28 language characteristics, such as its clean syntax, it "everything is an
29 object" approach to life and so on which make it very attractive for
30 "collective" development where code-readability and recycleability
31 really begin to matter. I am not suggesting, at this point, a wholesale
32 transplant of the python language to sh but ways of building-in some of
33 its features or characteristics to ADD TO sh, to be an addition, rather
34 than replace sh].
35
36 On the issue you raise in your second mitigating factor, a kind of
37 runtime boot-failover could be one example of the things made
38 possible by introducing a more "extensible" shell.
39
40 Just to note: i envisage several levels of control or options. There
41 would, perhaps, be an initial build-time option to include python as a
42 part of an "actively extensible" shell. sh would be default and required.
43 python could then be toggled on and off at any time during by the use
44 of command line switches or arguments passed with shell commands.
45 additionally, optimisation switches could be passed as arguments to
46 shell commands, or in script files, that enable the python shell syntax
47 to behave exactly as required in given conditions or environments. For
48 example, (and these lame suggestions are only for illustrating my
49 point):
50
51 pye -a to activate a python-shell environment
52 pye -k to kill it and return to sh
53 pye -a -psh to activate a mixed sh/python shell environment
54 pye -k psh to kill the mixed environment and return to sh
55 pye -k psh -p to kill the mixed environment but allow python
56 shell to persist
57 pye -a -swoff to activate the python shell environment
58 (when swap off) except when swap is activated
59 and performance might be an issue (if the
60 python shell environment proved to have
61 performance issues)
62
63 etc etc etc...you see my point
64
65 of course, the python shell environment could be invoked and killed in
66 scripts in similar ways.
67
68 maybe we would in such cases be faced with the infinitive question of
69 whether to trade performance for functionality, vice versa, or whether
70 the trade-off in itself was necessary
71
72 the end result would be a new way to think of and use the shell
73
74 but now i pontificate :)
75
76 On 16 Apr 2003 at 16:54, Justin Whitney wrote:
77
78 > Thanks for the arguments thus far.
79 >
80 > So added to the cons list is:
81 >
82 > *addition of newer less-tested interpreter could add instability
83 > *very small/short scripts incur overhead
84 >
85 > Here are two mitigating arguments to counter the first statement.
86 >
87 > First - a separate, stable build of python could be used as the
88 > system-boot interpreter. it might make sense to statically link it and
89 > so forth to lower dependencies... perhaps even to optimize it in some
90 > respects, for its task.
91 >
92 > Second, a shell script like the runscript.sh that is already used could
93 > be used to launch the interpreter and check for a runtime failure. On
94 > failure it could launch the .sh version of the bootscript. This means
95 > keeping two copies of the shellscripts obviously (which wouldn't be a
96 > bad idea anyway...) this would at least have the benefit of salvaging
97 > the boot...
98 >
99 > As for the overhead problem with very small scripts, I don't see that
100 > going away... in fact converting such scripts would be a waste of time
101 > in the first place, because it doesn't make use of any of the advantages
102 > proposed by the change. It would make more sense to set up the boot
103 > process to be able to run both kinds so you don't waste your time.
104 >
105 > --Justin
106 >
107 >
108 > --
109 > gentoo-dev@g.o mailing list
110 >
111
112
113 --
114 Merv Hammer
115 mailto: merv@×××××××××××××.cy
116
117 --
118 gentoo-dev@g.o mailing list