Help get this topic noticed by sharing it on Twitter, Facebook, or email.

Variable initialisation

When are variables actually created/reset?

I use variables to e.g. control which buttons/images are to be displayed and it is obviously important that the contents are correctly maintained, but in order to do this successfully, I need to know exactly when variables get created and under what circumstances they are reset/re-initialised and their contents cleared.

For example, quitting the app doesn't clear them. When you re-start the app, the variables have obviously still got the same contents/values. Dropping back to the app's setup Menus also appears to not clear them. In fact I think the only time they get cleared is when I re-sync.

So, first of all, can we please have some clear information from the iRule team about exactly when and under what circumstances variables get cleared/re-initialised.

Could I also ask that we are provided with a command to do this, so we can include it in a macro and hence be used to re-set everything. I realise we could simply set every variable, but that would be a very long winded way of doing it and have to be meticulously maintained as new variables were introduced or 'retired'. But iRule itself has a list of currently used variables and can simply reset them all without having to be explicitly told about each variable.
3 people have
this question
+1
Reply
  • Answers to the above HAVE to come from iRule/Support. So would appreciate their input here.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated kidding, amused, unsure, silly indifferent, undecided, unconcerned happy, confident, thankful, excited

  • Still nothing.

    This is what I don't understand about iRule support. This is a valid question that in truth shouldn't need to be asked as it really should all be documented. It's a CRUCIAL part of any development environment and we should have this information available. But even after 2 weeks, they've not even bothered to reply. I don't understand this. Do they have some reason to not want us to know this sort of thing?
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. indifferent, undecided, unconcerned kidding, amused, unsure, silly happy, confident, thankful, excited sad, anxious, confused, frustrated

  • Based on personal experience using variables:

    Variables are set within buttons, links, entrances and feedback when programming as such within the builder.

    The only time variables are reset within the application are after syncing.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated kidding, amused, unsure, silly indifferent, undecided, unconcerned happy, confident, thankful, excited

  • Thanks Scott, but definitive confirmation from the developers would be real helpful here. Your experience almost mimics my own, but there are occasions when using the app and I have returned to the menus etc and then returned to my system and some variable contents have been lost. I have buttons whose graphics are set by variable (which contains the image (ID) and having dropped out and then back, sometimes the buttons are then blank. However, if I try that in order to clear variables, it doesn't seem to work. So the exact process by which variables get created and assigned values and then lose them is unclear, yet it is something that users like us absolutely need to know.

    Like many modern systems, variables in iRule are created on the fly without requiring specific declarations to create them, but there is no way to clear them or 'UNset' them. These are different and we need better tools to deal with variables. Specifically:-

    Search and Replace. Trying to rename a variable is a ridiculously convoluted task, with no way of knowing where any particular variable might have been used, how is one supposed to track down all instances and change the name.

    Set and UNSet. We can control when the variable is created, but we cannot unset/destroy it and this is sometimes important to recover a known state.

    Clear. We need to be able to clear individual and ALL variables. This could be done in a repeat loop with access to a list of all current variables. We don't have either.

    We need to know ABSOLUTELY how commands that use variables will function when the variable is unset and also when it is empty. Again, these are different states and it seems iRule behaves differently to each in different uses, particularly with regard to use of any supplied default value. This does seem to be used if the variable is not yet set, but when it has been cleared by Setting it to "", i.e. nothing, the default value MAY be used, depending on the actual use of the variable. Trying to program with vagaries like that is like trying to nail jelly to the wall (jello to those of you in the US).

    With respect, it's as if variables were an afterthought and thrown in without really thinking through what is required to actually comprehensively deal with them.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. indifferent, undecided, unconcerned kidding, amused, unsure, silly happy, confident, thankful, excited sad, anxious, confused, frustrated

  • And still waiting for some sort of decent response from the iRule team. Scott did try, but was wrong. I use a variable to define what type of handset it is operating on. So it might be set to iPhone4 or iPhone6 or iPad2 or whatever. This is set at the very beginning and during normal usage, should never need to be reset unless starting it on another handset. But what ACTUALLY happens is that periodically, when I see stuff misbehaving I go back and check and it's lost the value for the variable. This might take a few weeks to occur, or only a few days, but it DOES occur.

    There are many other instances of variables that I use for fundamental control of the operation of my system and that simply lose their value. It's not just one isolated variable that has this problem, it's ALL variables. Which leads to 2 points to make:-

    This should simply NOT occur. If the app is running and has not been quit or updated or anything like that, at any time, then every variable should maintain its value - indefinitely. But irrefutably it does NOT.

    I have to ask YET AGAIN. When does iRule clear the variables? I could deal with it if I knew when it took it upon itself to clear them. I don't want any wishy washy thoughts about when they might be cleared. Or fundamentally inaccurate statements about the variables never being cleared.

    This is really trying my patience now. For too long the iRule team have been fobbing us off with misinformation and excuses. How can they possibly believe it's acceptable to provide a programming environment with variable usage but refuse to divulge when the program unilaterally deletes values held by any of these defined variables.

    Maybe they think I'm being unfair. Ok, SO SAY SO HERE and explain exactly how I am being unfair. Provide the much needed answers to these questions and show me I'm wrong and that you're a caring sharing provider of a great programming tool.

    Right now it rather appears that you don't give a damn.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated kidding, amused, unsure, silly indifferent, undecided, unconcerned happy, confident, thankful, excited

  • On my android Nexus 7 the variables are reset to their defaults every time the app is launched. It does not matter if the app crashes or if I quit the app or if I shut down the tablet.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated kidding, amused, unsure, silly indifferent, undecided, unconcerned happy, confident, thankful, excited

  • That's not my experience on iOS. I'm pretty sure that at least some of them survive the app being closed and restarted as I've tried to use that to clear everything and start again, but it doesn't work.

    However, a few days ago I used iRule and all was working as it should with the variables obviously set correctly. I finished for the evening and put the iPhone to sleep. The next evening I woke up the iPhone and tried to use iRule, but the variables had been lost. Nothing had been done in the meantime.

    So I have NO idea when variables are cleared or not cleared and this is what I think is unacceptable. Well, that and the fact they're not even bothering to reply to this.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated kidding, amused, unsure, silly indifferent, undecided, unconcerned happy, confident, thankful, excited