Re: scope of variables

new topic     » goto parent     » topic index » view thread      » older message » newer message

It occurs to me that the current behavior is inconsistent with respect to forward referencing.

You can't forward reference inside a procedure.

You can do this at the file level.

This breaks:

procedure x() 
	b = 1 
	integer b 
end procedure 

This works:

procedure x() 
	b = 1 
end procedure 
x() 
integer b 

But this breaks:

b = 1 
integer b 

It does seem like routine-scopes are already handled specially. Maybe we can contiue to justify the special treatment of routine-scopes (backwards compatible symbol shadowing remains supported) while changing the rest (so integer b...for...integer b...end for and for...integer b...end for..integer b both break).

On the other hand, it might be easier to make all scoping rules apply equally to all the different scopes.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu