Sign in to follow this  
Followers 0
storme

STATIC keyword

9 posts in this topic

#1 ·  Posted (edited)

G'day All

I've kind of fallen in love with the STATIC keyword.

I've used it in a few scripts now and it works really well (now that I understand how it works!)

At first glance I thought what will this ever be used for but after playing with it I think it helps enormously with encapsulating UDF variables.

However, I'm a little worried about using it because of the warning

Warning: This feature is experimental. It may not work, may contain bugs or may be changed or removed without notice.

DO NOT REPORT BUGS OR REQUEST NEW FEATURES FOR THIS FEATURE.

USE AT YOUR OWN RISK.

BUT.... it has been aroudn since "18th December, 2009 - v3.3.2.0" and hasn't been removed...YET...

So is a fixture now, are there plans to remove it

OR

If it isn't a fixture and only "experimental" how long will experiment last for?

If it's sticking around I'll start using it.......if it's going I'll go back to global vraiables. ;)

Thanks for the answer(s) :)

John Morrison

Edited by storme

Share this post


Link to post
Share on other sites



I see a similarity to the other experimental feature, plugins. The plugin-API has been unchanged since 2007 and never left experimental stage.


*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites

I personally use ByRef Or Global in situations where I need to retain a Local variable outside of the Function. I think it's experimental due to the fact it could become messy with debugging the code. Just my 2cents :)


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

I see a similarity to the other experimental feature, plugins. The plugin-API has been unchanged since 2007 and never left experimental stage.

But that is the problem. Being around for that long you can "ASS-U-ME" that it's a fixture untill one of the devs decide the experiment is over and he removes it. ;)

Though plugin looks like it will be aroudn for ever. :)

Thanks for the advice.

Share this post


Link to post
Share on other sites

Assume that it can break, you can always replace your static variables with global variables. I think a 10 line script could, in fact, do that for you. So go for the new feature, and if it breaks it'll take 10 seconds to "fix it".

Share this post


Link to post
Share on other sites

I personally use ByRef Or Global in situations where I need to retain a Local variable outside of the Function. I think it's experimental due to the fact it could become messy with debugging the code. Just my 2cents :)

Yes but ByRef and Globals can get messy if the UDF gets complex.

Maybe it's it's just me OO traning kicking in that makes me shy away from global variables.

Oh and the possibility of using the same global name in multiple UDFs.

STATIC means I can hide the variables I want to keep/reuse for that function inside that function.

Thanks for the feedback!

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

DO NOT REPORT BUGS OR REQUEST NEW FEATURES FOR THIS FEATURE.

Mmm. So tracker it out. ... bummer.

... Forum not that user friendly when it comes down to tracking down known/potential "Static" issues. ...

Edited by iEvKI3gv9Wrkd41u

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

You should find it in Dev chat.

As I recall the issues were mainly around using Static with arrays and as a matter of fact I was just asking this very question in a PM a couple of days ago.

I do know that the Developer that was working on this hasn't been around in a while and it appears that nobody has picked up where he left off as of yet.

EDIT: I also seem to recall a discussion where someone stated to the effect that if Static become problematic it would simply be removed.

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Roger. Waiting until 'Static' Development seems to be picked up again.


"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0