[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] Static variables - why can't it be this simple?



PureBytes Links

Trading Reference Links

Hello,

There were two main reasons why it was done via functions:

a) static variables often use dynamic names (to use unique name based
on chartID and security name). With "declaration" method it won't be possible.

b) it was actually quicker for me to implement them as functions
as it did not require any changes to parser. Parser is pretty complex
thing and any changes made to it need lots of testing and at the time
when I was adding static variables I was short on time.

I was considering adding 'static' declaration as additional method
but did not have time to work on this.

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "scourt2000" <stevehite@xxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Sunday, August 19, 2007 7:16 PM
Subject: [amibroker] Static variables - why can't it be this simple?


> 
> I come from a programming background and something has been kinda 
> been bothering me about AFL.
> 
> Why even have StaticVarGet() and StaticVarSet() functions? 
> 
> Think about it. Tomasz can do anything he wants with the scripting 
> language so why not build in static variables *into* AFL?
> 
> For example, you want a static variable that's local to an AFL 
> script?
> 
> No problem, here's the declaration:
> 
> static variablename;
> 
> Do you want a static variable that is GLOBAL to *all* AFL scripts?
> 
> Again, no problem, this could do it:
> 
> global static variablename;
> 
> And, of course, it doesn't matter whether the variable is a string, 
> number or array.  It's all TRANSPARENT because it would be built-in 
> to AFL.
> 
> Sure, this is a simplistic approach and just an initial idea.  I 
> know that the next common question is going to be "what if you have 
> a "static variablename" in one AFL module and a "global static 
> varaiblename" in another and that creates a problem because the 
> names of the variables are the same but at different scopes that 
> overlap one another....etc. etc. (details, details...this can easily 
> be worked out with more thought)  [Well, a more sophisticated 
> approach would incorporate the idea of namespaces like you have in 
> C++, etc so you can easily organize the partitioning of your 
> variables.]
> 
> The main point I'm trying to make though is that since AFL is built 
> into the charting package known as Amibroker then the language 
> itself should be able to express the nature of a variable's scope 
> within and between AFL scripts running inside Amibroker and their 
> respective lifetimes.
> 
> Steve
> 
> 
> 
> 
> 
> 
> 
> 
> Please note that this group is for discussion between users only.
> 
> To get support from AmiBroker please send an e-mail directly to 
> SUPPORT {at} amibroker.com
> 
> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> http://www.amibroker.com/devlog/
> 
> For other support material please check also:
> http://www.amibroker.com/support.html
> 
> Yahoo! Groups Links
> 
> 
> 
> 
>


Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/