Page, Bill [EMAIL PROTECTED] wrote: > > I don't disagree that most *finished* worksheet read from > > top to bottom, and the commands run from top to bottom, but > > that need not be the norm. Document is a good analogy: modern > > documents are not linear, because we now have hyperlinks; > > we can, and want to, skip around! A program is the same, > > the code need not be linear in structure: we may have parts > > A, B, C in parallel followed by D that depends on A, B, C; > > code can even have a circular structure (like Axiom > > domains). Compilers do code optimization by exploring the > > non-linear structure of the code. > > I think that that is a very good point.
Perhaps it would be good to point out that even within one
document/worksheet, one could have independent subsets. e.g. If section
A does not depend on any definitions from outside, then it exists as an
independent unit. Functions defined there can be used elsewhere,
without causing anything in section A to be recomputed.
C++ and other languages have elevated this to the level of "namespaces"
which is an incredibly good idea. Mma/Maple worksheets tend to have a
poor separation between global and local variables. Over-use of global
variables was recognized long ago as a large source of errors and bugs.
Yet in math we assume implicitly that there is one global namespace.
My point is that lazy re-evaluation is not mutually exclusive with
non-linear documents.
Circular dependencies, however, deserve more thought. This could break
lazy re-evaluation logic. But, is there any *sensible* document with
circular dependencies? I would call a circular dependency a "bug".
(one which an intelligent front-end could warn the user about)
Here is some discussion on this from the smv language (some kind of
formal verification tool)
http://www.cis.ksu.edu/santos/smv-doc/language/node17.html
In the realm of classes, people seem to agree that creating interfaces
is the way to remove cyclical dependencies:
http://java.sun.com/docs/books/tutorial/java/concepts/interface.html
Another recommended method to resolve circular dependencies is to
specify an evaluation order. However, that's exactly what is provided
by a worksheet.
--
Cheers,
Bob McElrath [Univ. of California at Davis, Department of Physics]
"One of the best ways to get yourself a reputation as a dangerous citizen
these days is to go about repeating the very phrases which our founding
fathers used in the great struggle for independence." --Charles A. Beard
signature.asc
Description: Digital signature
_______________________________________________ Axiom-developer mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/axiom-developer
