[Rationale][Design] Name resolution ?

Discussion forum about all things SqlBase or SqlTalk
ychaouche

[Rationale][Design] Name resolution ?

Post by ychaouche » 27 May 2012, 16:59

Hello,

Suppose you have a PARENT form with a CHILD table. In both PARENT and CHILD, you declare a window variable called hSqlHandler. You get this error :

Code: Select all

Error: hSqlInsert is defined by more than one form, dialog, or table window. Must qualify the reference.
In other languages, name resolution is done from the bottommost scope to the topmost scope.

For example suppose you have a this configureation

Code: Select all

Module M (globale variable) : V
Class C (class variable) : V 
Method M (local variable) : V.
Object O (instance variable) : V
Depending on where you are, i.e where you use V, the environement looks for the closest source of the variable definition.

For example :

if you use V inside your method M, it looks first if V is in the local variables, if not, it looks if V is an instance variable of object O, if not, it checks if it's a class variable and so on until it reaches the global scope.

In TD, it just can't compile.

Any comments ?

ychaouche

Re: [Rationale][Design] Name resolution ?

Post by ychaouche » 27 May 2012, 17:12

So do all variables, kind of share the same namespace ?

Jeff Luther
Site Admin
Site Admin
United States of America
Posts: 2385
Joined: 04 Mar 2017, 18:34
Location: Palm Springs, California

Re: [Rationale][Design] Name resolution ?

Post by Jeff Luther » 30 May 2012, 18:10

What's missing in your description is the context of where hSqlInsert is being called. If referenced in the PARENT, then TD would/should use its local instance; if ref'd within the CHILD, TD would use the CHILD instance.
Depending on where you are, i.e where you use V, the environement looks for the closest source of the variable definition.
Yes, that's just what I wrote. So, until you provide a little code to show the context of the hSqlInsert statement causing the compile error I would say that TD is behaving correctly. In effect, the error is telling you that your code has 2 or more decls. of this var at the same scoping level.

BTW, TD's scoping is essentially inside/Local --> outside/Global.
Jeff Luther @ PC Design
Palm Springs, California

Return to “SqlBase General Discussion”

Who is online

Users browsing this forum: [Ccbot] and 0 guests