Expressiveness.
David Collier-Brown
daveb at geac.UUCP
Fri Mar 25 23:47:06 AEST 1988
In article <25930 at cca.CCA.COM> g-rh at CCA.CCA.COM.UUCP (Richard Harter) writes:
| ... then there are programs of length N and execution time
| O(N) in language B such that any equivalent program in language A requires
| either O(N logN) execution time or O(n *exp(N)) space, or some combination
| thereof. By this criteria the goto is more powerful than the while-loop.
| The hierarchy of strengths runs
|
| while-loop
| forever-loop-with-multiple-escapes
| goto
| procedure-invocation-and-return
| computed-goto/switch
|
| The switch construct is equivalent in power to the computed goto.
|
| This measure of power is unambiguous. One can also speak of the expressiveness
| of a construct, in the sense of what can be easily done in the language.
| Although this is probably the most useful criteria (and I suspect what you
| really) meant it is obviously vague and subjective.
Ah, now that's interesting.
I wonder if we can define a measure for expressiveness in like
terms, and judge fairly (at the "big-O" level) between them.
I envisage something like
expressiveness::= (to + from)
to::= space (in characters) occupied by a given construct
from::= time (in character-transformations) to decompose the
construct into its primitives
Specifically, I see an if-else as
to = "if (expression) { statement } else { statement }"
= 40 characters
from = "(expression) ifgoto { statement goto } { statement }"
= 8 added + 4 removed
= 12 characters
Therefore an if-else costs 40 units to write, and 12 more units to
write/read as a transformation into simpler terms.
Yes, I well realize I'm bullshitting with the character counting.
This is a proposed "proof of concept" of a rather fuzzy idea.
--dave (try it on Dijkstra's if's and do's) c-b
--
David Collier-Brown. {mnetor yunexus utgpu}!geac!daveb
Geac Computers International Inc., | Computer Science loses its
350 Steelcase Road,Markham, Ontario, | memory (if not its mind)
CANADA, L3R 1B3 (416) 475-0525 x3279 | every 6 months.
More information about the Comp.lang.c
mailing list