Article View: comp.lang.misc
Article #5Re: Copmaring Power (Expressivity) of Two Languages
From: Chris Torek
Date: Tue, 27 Oct 1992 17:09
Date: Tue, 27 Oct 1992 17:09
58 lines
3512 bytes
3512 bytes
In article <1992Oct27.091848.13551@eua.ericsson.se> joe@erix.ericsson.se
(Joe Armstrong) writes:
>Notes: 1) I'm not interested in the shortest program only a program which is
>reasonable clear and gets the job done with a minimum of fuss.
> 2) Expressibility is in the eye of the beholder.
I think these notes show that Joe Armstrong's definition is not
terribly objective. :-)
It seems to me that there *is* no real `stand-alone' measure of a
language's `power', and certainly no measure that allows sorting
a series of languages along a line of `more powerful/less powerful'.
One objective and useful (if a bit difficult to apply) measure might
be:
Language L1 is more powerful than L2 at expressing an operation o
if and only if L1 can express o in fewer primitive statements.
Here a language $L$ is regarded as a set $S$ of `primitive statements'
${ s_1, s_2, ..., s_n }$. Every operation $o$ that can be expressed at
all in $L$ can be regarded as one or more sequences $O_e$ made up of
elements from $S$ arranged according to any rules required by $L$.
(Each different sequence $O_e$ is a different way of expressing the
operation.) We find the minimum measure of these sequences and take
that as the `least number of primitive statements needed to do $o$ in
$L$'.
Note that we do not care about the spelling of individual primitives
(this renders differences like `int' vs `integer' irrelevant).
This power-measure has some interesting implications:
- It only works `per operation'. Two different languages can
alternate as more and less powerful for two different operations.
This seems reasonable, since a language with a special primitive
for some operation will obviously do better than one without,
and any two languages could have different special primitives.
- Given two otherwise-identical languages L1 and L2, where L1
requires declarations but L2 does not, L2 will always be at
least as powerful as L1.
The latter does not make L2 `better' than L1, any more than the fact
that a power saw cuts wood faster makes it `better' than a hand saw
(it is a lot harder to cut off a finger with a hand saw). It does
imply that L2 may be faster to use, when one is skilled at operation
(much as power saws are faster but more dangerous).
This particular measurement does not help when one language can express
an operation that the other cannot at all (e.g., if L1 has arrays and
L2 does not, and the chosen operation is array subscripting), but
usually we can find a more general form of the operation (e.g., find
the n'th element of a sequence) that can be done in both languages. (I
suspect that, in such cases, L1 will usually beat L2 in power.)
--
In-Real-Life: Chris Torek, Lawrence Berkeley Lab CSE/EE (+1 510 486 5427)
Berkeley, CA Domain: torek@ee.lbl.gov
Technical Details
Message-ID:
<26993@dog.ee.lbl.gov>Path:
arc1-ca.pugleaf.net!sparky!uunet!think.com!ames!agate!dog.ee.lbl.gov!horse.ee.lbl.gov!torekReferences:
<1992Oct20.193129.251@thinkage.on.ca> <BwJ4Ms.1Mo@rice.edu> <1992Oct23.132146.20784@eua.ericsson.se> <Bwqs8L.1v3@phage.cshl.org> <1992Oct27.091848.13551@eua.ericsson.se>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!think.com!ames!agate!dog.ee.lbl.gov!horse.ee.lbl.gov!torek From: torek@horse.ee.lbl.gov (Chris Torek) Newsgroups: comp.lang.misc,comp.programming Subject: Re: Copmaring Power (Expressivity) of Two Languages Date: 27 Oct 1992 17:09:11 GMT Organization: Lawrence Berkeley Laboratory, Berkeley Lines: 58 Message-ID: <26993@dog.ee.lbl.gov> References: <1992Oct20.193129.251@thinkage.on.ca> <BwJ4Ms.1Mo@rice.edu> <1992Oct23.132146.20784@eua.ericsson.se> <Bwqs8L.1v3@phage.cshl.org> <1992Oct27.091848.13551@eua.ericsson.se> Reply-To: torek@horse.ee.lbl.gov (Chris Torek) NNTP-Posting-Host: 128.3.112.15