Question About Global Variables

General questions about NeoAppBuilder - our rapid application development tool for building HTML5, web and mobile apps.

Moderator: Neosoft Support

Locked
Neosoft Support
NeoSoft Team
Posts: 5628
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA
Contact:

Question About Global Variables

Post 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.
NeoSoft Support
User avatar
Gaev
Posts: 3782
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada
Contact:

Re: Question About Global Variables

Post 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>
User avatar
luishp
Posts: 410
Joined: Wed May 23, 2007 10:17 am
Location: Spain
Contact:

Re: Question About Global Variables

Post by luishp »

I do agree with Gaev.
:-)
Luis Hernández - SinLios Soluciones Digitales
http://sinlios.com
Neosoft Support
NeoSoft Team
Posts: 5628
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA
Contact:

Re: Question About Global Variables

Post 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.
NeoSoft Support
Locked