On Fri, May 10, 2013 at 8:30 AM, Ian Kelly <ian.g.ke...@gmail.com> wrote:
> On Thu, May 9, 2013 at 3:51 PM, Mark Janssen <dreamingforw...@gmail.com> 
> wrote:
>> the community stays fractured.
>
> The open source community seems pretty healthy to me.  What is the
> basis of your claim that it is "fractured"?

The carpentry community is fractured. There are people who use
screwdrivers, and there are people who use hammers! Screws and nails
are such completely different things that we shouldn't try to use the
same language to discuss them.

>> Language "expressivity" can be measured.
>
> And the measurements can be endlessly debated.  Expressivity is not
> the sole measure of a programming language, though.

Every programming language can encode every program. It's fairly
straightforward to prove that a Python interpreter can be written in
Ruby, or a C interpreter in Lua; so there is no program that can be
expressed in one language and not in another (there will be apparent
exceptions, eg web-browser JavaScript cannot call on arbitrary C-level
functionality, but if the entirety of program code were written in C,
then it could all be interpreted by one C interpreter).

Larry Wall of Perl put it this way, in a State of the Onion address:

http://www.perl.com/pub/2007/12/06/soto-11.html
"""... Human languages are Turing complete, as it were.

Human languages therefore differ not so much in what you can say but
in what you must say. In English, you are forced to differentiate
singular from plural. In Japanese, you don't have to distinguish
singular from plural, but you do have to pick a specific level of
politeness, taking into account not only your degree of respect for
the person you're talking to, but also your degree of respect for the
person or thing you're talking about.

So languages differ in what you're forced to say. Obviously, if your
language forces you to say something, you can't be concise in that
particular dimension using your language. Which brings us back to
scripting.

How many ways are there for different scripting languages to be concise?
"""

In C, for example, you are forced to write explicit notation
representing {blocks; of; code;} and explicit characters separating;
statements;. In Python, on the other hand, you have to write out your
indentation. In Java, you state what exceptions you might throw. REXX
mandates that you annotate procedures with their list of exposed names
(effectively, non-local and global variables). So the expressivity of
a language can't be defined in terms of how many programs can be
written in it, but in how concisely they can be written - and that's
something that depends on specific design choices and how they align
with the code you're trying to write.

Compare these two snippets:

#!/bin/sh
pg_dumpall | gzip | ssh user@host 'gzip -d|psql'

#!/usr/bin/env python
words=input("Enter words, blank delimited: ")
lengths=[len(x) for x in words.split(" ")]
print("Average word length: %d"%int(sum(lengths)/len(lengths)))

Could you write each in the other's language? Sure! But it won't be as
concise. (The Python version of the shell script could cheat and just
call on the shell to do the work, but even that would add the
expressive overhead of "os.system".) This is why there are so many
languages: because each is good at something different.

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to