6.1.3 Experiements - Globals Scope??

Hi Folks

Whist experiementing with 6.1.3 web client I have noticed this error in the console as soon as the app is opened.

Scope 'globals' was accessed while not fully created yet, check for scope variables recursively referring to each other

The form opening has only an onLoad event and there are no globals being referenced at all. I cant see how that error can relate to the first form and there are no other onOpen methods in the solution opening?

Any suggestions on where I might look for this error would be welcomed!

Hi Ian,

Seems the error is referring to scope variables. Do you have globals (scope) variables that refer to other global variables when declared?

ROCLASI:
Hi Ian,

Seems the error is referring to scope variables. Do you have globals (scope) variables that refer to other global variables when declared?

I do have a globals declaration that relates a a global function, but that function does not call any other globals (if that makes sense)?? However on checking it is whats causing that problem

var $PoweredBy = 'Powered By Strategic Influence - Gap Analysis Pro Tools - Copyright Strategic Influence ' + globals.getFullYear();

The get full year is a function though so should it be causing this issue?

Hi Ian,

I see the same thing when I refer to a global method from same scope as the global variable

/**
 * @type {String}
 */
var testVar = globals.myTestFunction();

function myTestFunction() {
	return "my test function result"
}

This results in “Scope ‘globals’ was accessed while not fully created yet, check for scope variables recursively referring to each other”

I tried to move one or the other to a submodule but I get the same error. It seems this is a limitation.
I guess you need to add the year in a method like the onSolutionOpen() event.

Hope this helps.

Hi Ian,

I did another test and you can call something from another scope.
So if your variable is in the globals scope and your getFullYear() function is scopes.myUtils.getFullYear() then it all works fine.

Hope this helps

ROCLASI:
Hi Ian,

I did another test and you can call something from another scope.
So if your variable is in the globals scope and your getFullYear() function is scopes.myUtils.getFullYear() then it all works fine.

Hope this helps

Cheers Robert - have a good one tonight if you are celebrating.

All the best from us here at SCM

this:

ROCLASI:

/**
  • @type {String}
    */
    var testVar = globals.myTestFunction();

function myTestFunction() {
return “my test function result”
}

should be:

/**
 * @type {String}
 */
var testVar = myTestFunction();

function myTestFunction() {
	return "my test function result"
}

do not prefix stuff that don’t need to be prefixed. you are already in “globals” so no need to say “globals.xxxx” to access “xxxx”

The above code will also not give you that warning.

same for:

var $PoweredBy = 'Powered By Strategic Influence - Gap Analysis Pro Tools - Copyright Strategic Influence ' + globals.getFullYear();

I guess you are already in globals right? so it is globals.$PoweredBy ?
do then use this:

var $PoweredBy = 'Powered By Strategic Influence - Gap Analysis Pro Tools - Copyright Strategic Influence ' + getFullYear();

Hi Johan,

jcompagner:
do not prefix stuff that don’t need to be prefixed. you are already in “globals” so no need to say “globals.xxxx” to access “xxxx”

I understand what you are saying but why would it error when you do use the prefix? It is calling the same code after all.

when you have this:

var var1 = myfunction();

var var2 = 10;

function myfunction() {
  return var2;
}

that will completely fail. and that is what we try to warn about.

If you do this in globals:

var x = globals.y

and x is in globals then for us you are touching the globals scope even if that scope is not fully created yet (all the variables that are defined after x are not there yet)
So for us when we see that “globals” is asked for and we know that we are still creating the “globals” scope, then we know you are accessing a scope that is not fully initialized correctly, so we warn for that (we are returning a partial initialized scope so that it does work for most of the time, especially asking for functions, those are already there)

this was really a warning because some where going from scopes.globals (init of a variable there) to scopes.myscope and then via via back to scopes.globals and so on…
Then it is becoming a mess quite fast. Inside one file it is most of the time obvious.

in globals:
scopes.globals.a = scopes.myscope.b

then in myscope:
scopes.myscope.c = scopes.globals.d

then when myscope is created because of the globals.a creation it created “b” that works fine then i creates “c” but that goes back to “globals.d” but that one is not there yet because “a” is still busy.