--* From postmaster%watson.vnet.ibm.com@yktvmv.watson.ibm.com  Tue Jun 29 14:21:34 1993
--* Received: from yktvmv2.watson.ibm.com by radical.watson.ibm.com (AIX 3.2/UCB 5.64/900524)
--*           id AA12343; Tue, 29 Jun 1993 14:21:34 -0400
--* X-External-Networks: yes
--* Received: from watson.vnet.ibm.com by yktvmv.watson.ibm.com (IBM VM SMTP V2R3)
--*    with BSMTP id 6003; Tue, 29 Jun 93 14:22:28 EDT
--* Received: from YKTVMV by watson.vnet.ibm.com with "VAGENT.V1.0"
--*           id <A.SANTAS.NOTE.YKTVMV.1959.Jun.29.14:22:27.-0400>
--*           for asbugs@watson; Tue, 29 Jun 93 14:22:27 -0400
--* Received: from bernina.ethz.ch by watson.ibm.com (IBM VM SMTP V2R3) with TCP;
--*    Tue, 29 Jun 93 14:22:26 EDT
--* Received: from neptune by bernina.ethz.ch with SMTP inbound id <19198-0@bernina.ethz.ch>; Tue, 29 Jun 1993 20:22:17 +0200
--* From: Philip Santas <santas@inf.ethz.ch>
--* Received: from rutishauser.inf.ethz.ch (rutishauser-gw.inf.ethz.ch) by neptune id AA14879; Tue, 29 Jun 93 20:22:10 +0200
--* Date: Tue, 29 Jun 93 20:22:09 +0200
--* Message-Id: <9306291822.AA01034@rutishauser.inf.ethz.ch>
--* Received: from ru7.inf.ethz.ch.rutishauser by rutishauser.inf.ethz.ch id AA01034; Tue, 29 Jun 93 20:22:09 +0200
--* To: smwatt@watson.ibm.com, sutor@watson.ibm.com, bmt@watson.ibm.com
--* Subject: recursions in A#
--* Cc: asbugs@watson.ibm.com, jenks@watson.ibm.com, santas, bronstein, williams

--@ Fixed  by: SSD Fri Jul 16 15:21:42 1993
--@ Tested by: none
--@ Summary:   Recursive definitions are being handled as specified by the language.


We need to distinguish between two forms of definitions,

recursive and non-recursive.

Assignment to a var should be non-recursive.
Assignment to a funtion should be recursive (if needed).

Consequently one needs to distinguish also between \lambda defintions
and function definitions.
  foo(x) == b
should not be the same as
  foo == x +-> b
in general.

To be more specific:

----------------------------------------------------
#include "aslib.as"

SI ==> SingleInteger
import SI

xx:=1
xx:= xx+1   -- this should be ok

yy:SI == yy+1  -- this should report an error
               -- since yy has not been defined before the assignment.

zz:SI := zz+1  -- same error

foo() == foo() -- this should be OK
               -- functions allow recrsive defs.

goo := ():SI +-> 1   -- this should be OK.
goo := ():SI +-> goo() -- this should be OK.
                       -- notice that there is NO recursion here,
                       -- since 'goo' is NOT a function.
     -- The same if we had '=='

zoo := ():SI +-> zoo() -- this should report error.
                       -- zoo has not been defined before.

qoo == ():SI +-> qoo() -- same error as before.
----------------------------------------------------

I know that I opened a can of warms, but this is the only way
I can think of, so that to deal with the problem properly.

Philip

 
--+ #include "aslib.as"
--+ 
--+ SI ==> SingleInteger
--+ import SI
--+ 
--+ -- This is OK.
--+ xx:=1
--+ xx:= xx+1   -- this should be ok
--+ 
--+ -- The behavior of uninitialized variables is not specified at present,
--+ -- so the fact that no error is reported is not a bug.
--+ yy:SI == yy+1  -- this should report an error
--+                -- since yy has not been defined before the assignment.
--+ 
--+ -- The behavior of uninitialized variables is not specified at present,
--+ -- so the fact that no error is reported is not a bug.
--+ zz:SI := zz+1  -- same error
--+ 
--+ -- This is OK.
--+ foo():SI == foo() -- this should be OK
--+                   -- functions allow recrsive defs.
--+ 
--+ -- These are OK.
--+ goo := ():SI +-> 1   -- this should be OK.
--+ goo := ():SI +-> goo() -- this should be OK.
--+                        -- notice that there is NO recursion here,
--+                        -- since 'goo' is NOT a function.
--+      -- The same if we had '=='
--+ 
--+ -- This should not report an error, and does not.
--+ -- Lambda constructs a closure which uses the value of zoo from
--+ -- the outer lexical scope.  If its defined when you need it, you get it.
--+ zoo := ():SI +-> zoo() -- this should report error.
--+                        -- zoo has not been defined before.
--+ 
--+ -- See the note for the last example.
--+ qoo == ():SI +-> qoo() -- same error as before.
