Re: A case for HTML as a programming language

From: Arthur J. O'Dwyer (ajo_at_nospam.andrew.cmu.edu)
Date: 11/11/04


Date: Wed, 10 Nov 2004 18:13:00 -0500 (EST)


On Wed, 10 Nov 2004, Michael Mendelsohn wrote:
>
> Casey Hawthorne schrieb:
>> Doesn't a programming language have to be able to branch, loop,
>> recurse, etc. under program control -- contents of variables?
>
> Why?

   Good question; after all, there exist plenty of languages without
either explicit branch statements (functional languages with pattern
matching) or variables (functional languages, Turing tarpits).
However...

> A program can be completely characterized by its input-output relation.
> The program gets some input and provides some output. How it does that
> is completely irrelevant. For reasons of economy, most programs use
> branching and looping when going from input to output; HTML does that
> directly.

   That argument is not supported by the mathematics. There are some
algorithms --- some programs, some input-output relationships --- that
simply require the use of loops. Some algorithms *cannot* be represented
by a finite state machine, no matter how big. One example would be a
program that reads input until it finds a "Q", and then prints out all
the input it's seen before that point... in reverse order. No HTML
finite state machine can duplicate that relationship; it requires a
"push-down automaton" --- an FSM connected to a data stack. Your
simplistic HTML model has no such "stack."

>> If it is only branching user control, isn't that just like shuffling a
>> bunch of index cards (as somebody else has pointed out)!
>
> No, it's not.
>
> When shuffling index cards, the user performs the algorithm; with the
> HTML "program", the user need only provide the input.

   A nonsensical distinction. Where do you draw the line between "using an
input device" and "performing an algorithm"? If the user has to turn a
crank in order to get results, is he "performing" an algorithm? Suppose
he has to turn a crank simply in order to see a placard informing him
which lever to pull in order to get results --- is he "performing" yet?

> Have you tried my sorting program [1] mentioned upthread? All you need
> to provide are the numbers 1 through 5, in any order, and the program
> sorts them. You can even watch it sort them. It can sort any subset of
> those 5 numbers, too!

   It's not sorting them --- the user is sorting them! After all, for
your little demonstration to prove anything, I have to know it actually
works... and to know that, I have to sort the numbers myself, don't I? ;-)

   Serious points: (1) Lose the "inputting/performing" semantic argument;
it's a hopeless case. (2) And learn the fundamental differences between
FSMs, PDAs, and Turing machines.

   (I'm not (yet) denying that standard HTML (4.0) might be
Turing-complete, since I haven't gotten the time to investigate it yet,
but certainly Michael's simple arguments aren't valid.)

-Arthur



Relevant Pages

  • Re: Letter to US Sen. Byron Dorgan re unpaid overtime
    ... and Richard made it clear that he understands the order ... >> of evaluation of a for loop. ... > using strlen but using an Oalgorithm when there is a trivial O ... >> In most other languages the terminating ...
    (comp.programming)
  • Re: WHY
    ... wtf why would i want to sort in an application, i can sort everything i need ... on the database side. ... > structure in Perl and most other scripting languages. ... If all you speak is English and you lack the intelligence ...
    (microsoft.public.excel)
  • Re: Blowfish Sign Extension implementation risk
    ... Usual approach is to specify the algorithm in a computer-understandable ... Some people work on proofs of program correctness: ... with more low-level languages like C, ... one could try to design the algorithm ...
    (sci.crypt)
  • Re: How to make Forth interesting?
    ... For lots of things specialized languages may have the easiest ... We could use an iTV card as a sort of Forth stamp and host web pages ... I was just joking about the insanely complicated way that you ... Naturally scripts that are simple in scripting languages are suppose ...
    (comp.lang.forth)
  • Re: Letter to US Sen. Byron Dorgan re unpaid overtime
    ... and Richard made it clear that he understands the order ... > of evaluation of a for loop. ... using strlen but using an Oalgorithm when there is a trivial O ... > condition is an end value and in these languages the strlen value ...
    (comp.programming)