Re: variable initializer circularity needs to be defined

Per Bothner wrote:
> Presumably it wouldn't be difficult to define circularity
> in terms of dependencies between variables and functions. 

Jonathan Robie wrote:
> Do you have a definition you would propose?

Would something like the following work?

A variable declaration V1 directly depends on a variable declaration
V2 if V1 has an initializing expression that contains a variable 
reference that is bound to V2.

(This begs the question of the meaning of "bound", but presumably
that is defined in the formal semantics.  If we disallow variable
redefinitions, we can define "bound" in terms of matching QNames.)

A function declaration F1 directly depends on a variable V2
if the function body of F1 countains a variable reference that is
bound to V2.

A function declaration F1 directly depends on a function declaration F2
if the function body of F1 contains a call bound to F2.

A variable declation V1 directly depends on a function declaration F2
if V1 has an initializing expression that contains a call bound to F2.

A (function or variable) declaration D1 depends on declaration D2
if one of:
(a) D1 directly depends on D2; or
(b) there is some declaration Dx such that D1 depends on Dx and Dx
depends on D2.

It is a circularity error if a variable depends on itself.
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/

Received on Thursday, 12 August 2004 21:25:43 UTC