Cweb

Some of you have tried CWEB ?
http://www-cs-faculty.stanford.edu/~knuth/cweb.html

It is another way to write a source code.

I wanted to get some feedback from people who would

have possibly tried it…

Thank you !
Julien_____________________________________________________________________________
Envoyez avec Yahoo! Mail. Une boite mail plus intelligente http://mail.yahoo.fr

julien CLEMENT wrote:

Some of you have tried CWEB ?
http://www-cs-faculty.stanford.edu/~knuth/cweb.html

It is another way to write a source code.

I wanted to get some feedback from people who would
have possibly tried it…

Getting a bit OT, but I’ll take a wild stab at this, having tried
studying web sources in the past.

Knuth has been drumming this for decades and there is practically
zero uptake in the real world market. IMHO Knuth doesn’t think
like the rest of us – he’s a mathematician. Gives examples of
algorithms in MIX/MMIX while practically every other educator uses
a programming language or clear pseudo-code. Half a century of R&D
in compiler optimization, and Knuth still insist on ramming MMIX
down our throats? :slight_smile: Do take Knuth with a bit of salt.

I’ve tried seriously studying the Pascal web/tangle/tex/mf web
sources, IMHO it’s a nightmare. In this age of nice source code
editors, you’d really need a cweb-capable editor. I ended up
studying PDF web outputs – easier to read minus all those text
markups, but then finding the corresponding text in the web
sources is extremely tedious. The single monolithic file system is
a no-no. For cweb, there are more files corresponding to C files,
but it’s not that much better. I’d rather normal C/C++.

I can’t help but think the cweb/web thing is meant to turn source
code into a big ‘elegant’ math equation. Maintainability is a
problem, plus cluing people into the cweb scheme is a problem too.

All hail ‘literate programming’ – it’s like the OLPC being a
marvelous pedagogical tool, but only in clean-room theory –
academically elegant and novel and whatever. Real cool stuff for
"up in the clouds" kind of academia. Practically, well… market
adoption of web/cweb speaks for itself.

There are stuff like Javadocs or Doxygen if you want to tie or
dovetail documentation writing into your source code.–
Cheers,
Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia

Getting a bit OT,

Agreed.

Knuth has been drumming this for decades and there is practically
zero uptake in the real world market. IMHO Knuth doesn’t think
like the rest of us – he’s a mathematician.

And this is a bad thing? Computer science is applied mathematics.

Gives examples of algorithms in MIX/MMIX

Yeah, MMIX is a bit dated, but the idea is to keep it simple.

while practically every other educator uses
a programming language or clear pseudo-code.

From a practical point of view, I agree that a standard programming language
or pseudo code is more useful. But Knuth is trying to convey basic ideas, not
make it easy for programmers to cut and paste without understanding what
they’re doing.

I can’t help but think the cweb/web thing is meant to turn source
code into a big ‘elegant’ math equation.

Source code is a big math equation, elegant or otherwise. Doubt it? Give me
your compiled source and I’ll return to you a (really huge) NUMBER that
defines your application.

Real cool stuff for
"up in the clouds" kind of academia.

Academia is not “up in the clouds”. It’s down to Earth basics. It’s from those
basics that we working programmers build “up in the clouds” applications.

This is the only serious disagreement I have with your comments.

JeffOn Thu July 24 2008 20:48, KHMan wrote:

Jeff wrote:

Getting a bit OT,

Agreed.

Yes, all OT, as below, but since Julien wanted feedback, I was
dumb enough to supply one data point. Awfully sorry for the
pollution. :slight_smile:

Knuth has been drumming this for decades and there is practically
zero uptake in the real world market. IMHO Knuth doesn’t think
like the rest of us – he’s a mathematician.

And this is a bad thing? Computer science is applied mathematics.

No, it’s not a bad thing. It makes his programs and approach to
programming a bit different from what normal folks do, that’s all.

Different != bad. YMMV, that’s all. If there is practically no
market adoption, it’s too bad for Knuth. Let the market decide.

If you read the TeX sources, (from vaguely remembered stuff) his
expression parser was elegantly simplified, but not very clear
code. In the description: a challenge to readers to understand it
or accept it as magic. Large portions of the TeX math layout code
are also barely commented, but ‘works’. Evidently very elegant
algorithms to Knuth, I’m sure. (This characterization is unfair to
literate programming, but I’m just talking about how the
originator of literate programming uses literate programming.) But
as for maintainability as a group effort…

[snip]

I can’t help but think the cweb/web thing is meant to turn source
code into a big ‘elegant’ math equation.

Source code is a big math equation, elegant or otherwise. Doubt it? Give me
your compiled source and I’ll return to you a (really huge) NUMBER that
defines your application.

You misunderstand. What I was trying to convey is that the
intention is to write a program, it works, it’s complete,
perfecto, and there, a ‘math equation’ QED’ed. It’s hard to start
hacking at TeX’s innards unless one becomes intimately familiar
with practically all of it – it’s like having to grok the entire
’equation’, all 535 pages of it. Maybe CWEB is better, I dunno.

I didn’t like studying WEB programs using a normal text editor,
even less the prospect of entering into or maintaining such a
project, but I do know there are special literate programming
editors that might possibly destroy my arguments, so again YMMV. I
am merely one data point.

Real cool stuff for
"up in the clouds" kind of academia.

Academia is not “up in the clouds”. It’s down to Earth basics. It’s from those
basics that we working programmers build “up in the clouds” applications.

This is the only serious disagreement I have with your comments.

Heh, I apologize for that slight increase in flowery language. :slight_smile:
Academia can push the cutting edge, but many things do not get
adopted for widespread use. The market is often a good predictor,
although many things do fly under the radar. In this case, I don’t
believe Knuth-style literate programming in its current form will
be embraced by the market anytime soon.

Thus, CWEB/WEB in particular is one specific thing that might not
’trickle down’ to mainstream programmers in its current form, just
as MMIX is something that is still mainly used when studying some
of Knuth’s texts. But one can also say that Javadocs and Doxygen
are the spiritual equivalents and are very popular today.

Since this is OT, hopefully I won’t post further on this thread.> On Thu July 24 2008 20:48, KHMan wrote:


Cheers,
Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia

hi,

I see python as literate programming.

eg, see doctest:
http://docs.python.org/lib/module-doctest.html

You write docs before the code. So then you have automated tests, and
examples too.

Also you can access the documentation for each object with the
.doc attribute, or the help() function in a running program or
from the interpreter.

Python is fairly close to pseudo code, and often looks nicer than pseudo code :slight_smile:

cu,On Fri, Jul 25, 2008 at 3:58 AM, julien CLEMENT wrote:

Some of you have tried CWEB ?
http://www-cs-faculty.stanford.edu/~knuth/cweb.html
It is another way to write a source code.
I wanted to get some feedback from people who would
have possibly tried it…

Thank you !
Julien


Envoy? avec Yahoo! Mail.
Une boite mail plus intelligente.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Jeff wrote:

Source code is a big math equation, elegant or otherwise. Doubt it? Give me
your compiled source and I’ll return to you a (really huge) NUMBER that
defines your application.

Source code is a human readable expression of instructions to a machine.
These instructions are logical in nature and may or may not have
mathematic elements.

For instance, you don’t need any math to put on your shoes and socks,
but if you don’t understand the necessary logic, which will you put on
first? Where will you put it?

Math is universal. A particular equation will produce identical results
no matter what language it’s expressed in, or what tools are used to
calculate it.

If a huge number defined an application, then every application ever
written would work on every computer/operating system ever created,
since a huge number is a constant, right … right?

CWC wrote:

Jeff wrote:

Source code is a big math equation, elegant or otherwise. Doubt it?
Give me your compiled source and I’ll return to you a (really huge)
NUMBER that defines your application.

If a huge number defined an application, then every application ever
written would work on every computer/operating system ever created,
since a huge number is a constant, right … right?

No.

If I remember my theory of computing lectures correctly, it is
possible to enumerate all possible programs (but not determine that they
halt) for a particular machine, because they are analogous to integers
(the programs, that is). When using fixed-width floating-point and
integer representations (again analogous to integers), it is possible to
enumerate all possible runs of all possible programs (because the
state-space is, by definition, finite).

But, just because it’s possible to take the definition (that is, the
machine code) of a particular program as an integer, it doesn’t mean
that it’s constant on every hardware platform.

Now, you could, theoretically, use an abstract notation, such as ANSI C,
and base your enumeration on this (only for programs that compile
correctly). This number would be consistent across platforms.

And to bring things back on topic:

The main weakness I can see in CWEB (from looking at it for 5
minutes…) is that it requires you to substitute one complex
abstract notation for another, while still requiring you to be an
’expert’ with the notation being replaced.

In contrast, something like Doxygen/Javadoc, require that you learn a
second, simple notation that is separate from the main syntax.

Ideally, all programs would be completely self-documenting, but this is
simply not going to happen (until they start to write themselves…).

CWEB is a good idea and shows the way forward, but the implementation
is, ultimately, flawed.

Eddy

Source code is a human readable expression of instructions to a machine.
These instructions are logical in nature and may or may not have
mathematic elements.

Mathematics is logic, and all logic can be expressed in mathematical notation.
There’s no fundamental difference. Algebra and geometry are two different
ways of looking at the same thing, hence algebra = geometry. Math = logic.

Math is universal. A particular equation will produce identical results
no matter what language it’s expressed in, or what tools are used to
calculate it.

Study finite automata and you’ll understand why I say software is applied
mathematics. All software. Every program ever written. Whether or not the
author was aware of it.

If a huge number defined an application, then every application ever
written would work on every computer/operating system ever created,
since a huge number is a constant, right … right?

I’m not sure if you’re being facetious or serious. Every compiled program is
just one really huge number. But not all computers use the same machine code.

Every binary program can be expressed as a_1(2^n) + a_2(2^(n-1)) + a_3
(2^(n-2)) + … + a_n, where the a_i are either 0 or 1 and the program is n
bits long. Or you could express it as p_1^(n_1) + p_2^(n_2) + … p_m^(n_m)
where the p_i are prime numbers and the n_j are integers. Infinitely many
ways. Ain’t math fun? :wink:

JeffOn Mon July 28 2008 16:33, CWC wrote:

The interesting parts are the variable parts.

Like when j turns into an elephant half way through the program –
then right near the end ‘+’ turns into the color blue.

All running computer programs are non deterministic, since the world
changes as they run.On Tue, Jul 29, 2008 at 12:06 PM, Jeff <j_post at pacbell.net> wrote:

On Mon July 28 2008 16:33, CWC wrote:

Source code is a human readable expression of instructions to a machine.
These instructions are logical in nature and may or may not have
mathematic elements.

Mathematics is logic, and all logic can be expressed in mathematical notation.
There’s no fundamental difference. Algebra and geometry are two different
ways of looking at the same thing, hence algebra = geometry. Math = logic.

Math is universal. A particular equation will produce identical results
no matter what language it’s expressed in, or what tools are used to
calculate it.

Study finite automata and you’ll understand why I say software is applied
mathematics. All software. Every program ever written. Whether or not the
author was aware of it.

If a huge number defined an application, then every application ever
written would work on every computer/operating system ever created,
since a huge number is a constant, right … right?

I’m not sure if you’re being facetious or serious. Every compiled program is
just one really huge number. But not all computers use the same machine code.

Every binary program can be expressed as a_1(2^n) + a_2(2^(n-1)) + a_3
(2^(n-2)) + … + a_n, where the a_i are either 0 or 1 and the program is n
bits long. Or you could express it as p_1^(n_1) + p_2^(n_2) + … p_m^(n_m)
where the p_i are prime numbers and the n_j are integers. Infinitely many
ways. Ain’t math fun? :wink:

Jeff


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Jeff wrote:

Every binary program can be expressed as a_1(2^n) + a_2(2^(n-1)) + a_3
(2^(n-2)) + … + a_n, where the a_i are either 0 or 1 and the program is n
bits long. Or you could express it as p_1^(n_1) + p_2^(n_2) + … p_m^(n_m)
where the p_i are prime numbers and the n_j are integers. Infinitely many
ways. Ain’t math fun? :wink:

Every file that can be stored on a computer can be reduced to a number.
That includes movie files, music files, pictures, even literature.
Now, if you insist that literature is math, then I’m going to have to
punch you.

(I do consider computer science a field of math, but this has nothing to
do with the enumerability of computer programs. And the art of computer
programming goes far beyond the theory of computer science.)–
Rainer Deyke - rainerd at eldwood.com

Rainer Deyke wrote:

Now,
if you insist that literature is math, then I’m going to have to punch you.

Will you punch me if I remind you that good mathematics/programming is
an art form, or will you just leave me to get killed on the next zebra
crossing? :stuck_out_tongue:

/me returns to lurking

Pete.

Now, if you insist that literature is math, then I’m going to have to
punch you.

:slight_smile:

(I do consider computer science a field of math, but this has nothing to
do with the enumerability of computer programs. And the art of computer
programming goes far beyond the theory of computer science.)

The fact that programming is as much art as science is an indication of its
immaturity. At one time, hardware design was equal parts art and science, now
it’s mostly science. Some day programming will reach that level of maturity.

(Disclaimer: I spent over two decades as a software engineer. I now make my
living teaching math at my alma mater. I see that as a natural progression,
and a heck of a lot of fun.)

JeffOn Mon July 28 2008 21:24, Rainer Deyke wrote: