lout-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: counter


From: Valeriy E. Ushakov
Subject: Re: counter
Date: Mon, 30 Aug 1999 08:09:44 +0400

On Sat, Aug 28, 1999 at 11:25:26PM +0300, address@hidden wrote:

> Is there a way to make a "counter" in layout ?

Lout is a functional language.  Functional languages use recursion to
express interation and indeed a look at standard Lout packages will
give you plenty of examples.

Imperative program is a step by step instruction.  The definititve
feature of a functional languge is referential transparency.  To put
it in other words: imperative languages, unlike functional, have
notions of "past", "now" and "future".  Thus imperative languges
explicate the state of compuations.

What's interesting about Lout is it's dual nature.  To repeat myself,
Lout is a functional language.  But waht's perhaphs overlooked is that
Lout also explicate the notion of "before" and "after", though not
*temporarily*, but *spatially*!  I'm talking here about "preceding"
and "following" xrefs.

Whan in an imperative language you write:

     i := i + 1;

The `i' in the RHS is the previous value of `i', while the `i' in the
LHS is the new `i'.  I.e.

     i_from_now_on := i_as_it_used_to_be + 1;


Consider Lout (this particular example not tested):

     export value
     def @FooCounter named @Tag {} right value { @Null }

and in the document:

     @FooCounter 5
     Foo counter is now { @FooCounter&&preceding @Open value }.
     # foo := foo + 1
     @FooCounter { @Next { @FooCounter&&preceding @Open value } }
     Foo counter is now { @FooCounter&&preceding @Open value }.

Looks familiar, though a bit cobolish, isn't it? :-)

Linguistically this is perfectly legal Lout, and this even works
correctly.  The problem is that Lout xref implementation is too lazy
and to resolve the chain of N assignments you will need N-1 runs,
because current implementation uses database from the previous run
(read-only) to resolve xrefs and, in parallel, writes a new database
for the next run (write-only).  Which is very frustrating.


I'm gald this question was brough up as it gave me opportunity to
mention the spatial/temporal dualism of Lout, the phenomenon I was
pondering for some time, but never had a pretext to bring to
discussion.  This question also gives a nive opportunity to lobby for
read-write DB one more time, especially since the seamingly
"implementation deatil" feature could be linked to a linguistic
feature in so interesting way.

SY, Uwe
-- 
address@hidden                         |       Zu Grunde kommen
http://www.ptc.spbu.ru/~uwe/            |       Ist zu Grunde gehen


reply via email to

[Prev in Thread] Current Thread [Next in Thread]