EXPORT vs AVars() - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: HP Prime (/forum-5.html) +--- Thread: EXPORT vs AVars() (/thread-6196.html) |
EXPORT vs AVars() - jgreenb2 - 05-03-2016 12:54 AM 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:
But the result seems the same. Why bother with AVars at all? RE: EXPORT vs AVars() - cyrille de brébisson - 05-03-2016 04:49 AM 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 RE: EXPORT vs AVars() - jgreenb2 - 05-03-2016 10:18 AM (05-03-2016 04:49 AM)cyrille de brébisson Wrote: Hello, Cyrille, Thanks. That's very clear. -- Jeff |