Post Reply 
EXPORT vs AVars()
05-03-2016, 12:54 AM (This post was last modified: 05-03-2016 01:11 AM by jgreenb2.)
Post: #1
EXPORT vs AVars()
I've started to fix up some old programs to be compatible with the latest firmware releases. A while back the function AVars() was added. However, I'm confused about what this actually does and how to best use it.

In my app I can declare:

Code:
EXPORT foo:="foo";

and this will create a variable that is scoped to the app. In other words I can access it from Home by either:

Code:
MyApp.foo

or simply

Code:
foo

if my current app is "MyApp".

Alternatively I can write:

Code:

foo;

function myFunc()
begin
  AVars("foo"):="foo";
end;

But the result seems the same. Why bother with AVars at all?
Find all posts by this user
Quote this message in a reply
05-03-2016, 04:49 AM
Post: #2
RE: EXPORT vs AVars()
Hello,

AVars has a couple of advantages over EXPORT:
- It does not require one to 'program'.
- AVars persist over a program recompile and an app being sent to a remote calculator
- AVars do not require the program to be loaded and compiled to be 'live'.

EXPORT has different advantages:
- In a program, you know that the variable exist and you can create/initialize it using a smla syntax
- global program variable can be hidden from users (ie, not exported)
- program global are slightly faster than AVars

Cyrille

Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP.
Find all posts by this user
Quote this message in a reply
05-03-2016, 10:18 AM
Post: #3
RE: EXPORT vs AVars()
(05-03-2016 04:49 AM)cyrille de brĂ©bisson Wrote:  Hello,

AVars has a couple of advantages over EXPORT:
- It does not require one to 'program'.
- AVars persist over a program recompile and an app being sent to a remote calculator
- AVars do not require the program to be loaded and compiled to be 'live'.

EXPORT has different advantages:
- In a program, you know that the variable exist and you can create/initialize it using a smla syntax
- global program variable can be hidden from users (ie, not exported)
- program global are slightly faster than AVars

Cyrille

Cyrille,

Thanks. That's very clear.

-- Jeff
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)