Page 1 of 1

Question About Global Variables

PostPosted: Wed Mar 11, 2015 8:35 am
by Neosoft Support
NeoBook includes a number of predefined Global Variables which include things like the current date/time, window size, etc. NeoAppBuilder will have something similar, but I wanted to get your input on two things:

1. Since the term "Global Variable" has a somewhat different meaning in JavaScript, should we call our global variables something else to avoid confusion? For example:

System Variables
Static Variables
Predefined Variables
Special Variables
or ???

2. To avoid conflicts with user-defined variables, should we add some type of prefix to global variables. For example, instead of [Time] we would use:

[#Time]

It doesn't matter that "#" is not a valid character for JavaScript variable names, since global variable names are simply place holders and are replaced by NeoAppBuilder's compiler. Using # as a prefix would work well since we use that for the special Unicode/ASCII code variables like [#13]. This makes sense for consistency, but is a departure from NeoBook methods.

Re: Question About Global Variables

PostPosted: Wed Mar 11, 2015 10:02 am
by Gaev
Dave:

Thanks for asking ... here is MHO ...

1) In declining order of preference ...

Predefined Variables
Special Variables
System Variables

2) As an alternative ... assuming NeoSoftAppBuilder can handle the syntax ... how about something like ...

[NAB.Time]
or
[NAB#Time]
or
[#NAB.Time]

This is predicated by the idea that NeoSoftAppBuilder could also provide corresponding (Global) Javascript variables for the developer's convenience ... in which case, taking advantage of Javascript's Object (JSON) facilities, the variables could be contained (as key/value pairs) in a single object ... so they could be accessed like ...

NAB.Time
NAB.ScreenWidth
etc. etc.

So, as a developer, all your "predefined variables" are in similarly named "objects" ... and accessible from NeoSoft or Javascript commands.

</MHO>

Re: Question About Global Variables

PostPosted: Wed Mar 11, 2015 1:05 pm
by luishp
I do agree with Gaev.
:-)

Re: Question About Global Variables

PostPosted: Fri Mar 13, 2015 10:03 am
by Neosoft Support
This is predicated by the idea that NeoSoftAppBuilder could also provide corresponding (Global) Javascript variables for the developer's convenience ...


That's a really interesting idea. I'll look into it further.