ergodic Posted November 9, 2014 Posted November 9, 2014 Having just come off another program-writing jag, I'd like to renew the request to have the ELSE clause be optional. The majority of programs don't even need the ELSE. But it's required presence creates the weird "self-cancelling" semantic that just creates work and confusion. This change wouldn't affect existing programs since they all have an ELSE. No ELSE would just need to do what I have to do manually, which is write two programs: one to evaluate the condition set, and a second that gets called by the first if it is true.
larryllix Posted November 10, 2014 Posted November 10, 2014 I don't remember anybody asking to do away with "Else" but I have seen requests to add an "IfElse" section(s). Isn't it possible to just not use it if preferred or is this a monitor screen real-estate shortage request to have it disappear?
andyf0 Posted November 10, 2014 Posted November 10, 2014 "weird "self-cancelling" semantic" Can you elaborate more? My understanding is you just leave the ELSE blank and it's as if it wasn't there.
LeeG Posted November 10, 2014 Posted November 10, 2014 ergodic is asking for a means of stopping the reevaluation of the If clause, not really asking for the elimination of the Else. The explanation of needing two Programs is the result of Wait/Repeat allowing the If clause to be reevaluated when Events/Conditions have changed. Thus the need for two Programs so the If reevaluation does not stop the current Then clause execution.
andyf0 Posted November 10, 2014 Posted November 10, 2014 Couldn't a program just disable itself in the THEN to prevent reevaluation if the conditions of the IF change. I haven't actually tried it.
larryllix Posted November 10, 2014 Posted November 10, 2014 Couldn't a program just disable itself in the THEN to prevent reevaluation if the conditions of the IF change. I haven't actually tried it. No. I raised this about two weeks ago and it was tested with X10 some X10 commands sequentially. The next line of program code executes (maybe) and then the program stops. Sounded like a good idea. I currently use that technique in the very last line of the "Then" or "Else" code.
apostolakisl Posted November 10, 2014 Posted November 10, 2014 Couldn't a program just disable itself in the THEN to prevent reevaluation if the conditions of the IF change. I haven't actually tried it. No. If you disable a program in its own "then" or "else" clause, it will immediately end the program. You have to put the "if" in one program which calls a second program "then" or "else" clause. The second program disables then reenables the first prgoram.
apostolakisl Posted November 10, 2014 Posted November 10, 2014 Curious thing. I was playing around with running disabled programs. I wrote this simple test program. If - No Conditions - (To add one, press 'Schedule' or 'Condition') Then Disable Program 'New Program' Wait 5 seconds $sTest = 5 Enable Program 'New Program' Else - No Actions - (To add one, press 'Action') When I do a "run then", it disables the program and terminates without setting the variable. Then, with the program still disabled, when I do a "run then" again, it actually runs the entire program and then re-enables it. It would appear that disabling a program from within that is already disabled has no affect on the program execution. I guess the ISY logic only recognizes a change in the enabled/disabled status of the program. A trigger if you will.
larryllix Posted November 10, 2014 Posted November 10, 2014 This sounds like a never thought of quirk in the ISY. With a "Stop program" command perhaps the "Disable" should do just that...disable triggers, meaning just the lines in the "If" section. Might be a useful feature, if it functioned as the syntax suggested, to temporarily disable your own triggers as many use two programs to accomplish this now as necessary in so many applications. I am all for it but, somehow I doubt this has anything to do with the OP's "Else" change request.
apostolakisl Posted November 10, 2014 Posted November 10, 2014 I would personally prefer it if the disabling a program while it was running did NOT affect the execution of a currently running then/else clause. It would be more logical for a "stop" command to be the only thing that stops a currently executing program. It doesn't make a lot of sense to have disabling stop executing a "then" or "else" clause since a program that is already disabled still can execute the "then" and "else" clause.
larryllix Posted November 10, 2014 Posted November 10, 2014 I would personally prefer it if the disabling a program while it was running did NOT affect the execution of a currently running then/else clause. It would be more logical for a "stop" command to be the only thing that stops a currently executing program. It doesn't make a lot of sense to have disabling stop executing a "then" or "else" clause since a program that is already disabled still can execute the "then" and "else" clause. Exactly! As I stated above this was probably never thought of as a desired feature when setting up the ISY command set. Now I want it.
andyf0 Posted November 10, 2014 Posted November 10, 2014 Exactly! As I stated above this was probably never thought of as a desired feature when setting up the ISY command set. Now I want it. I want it too ..... It just makes sense that "disabling" only disables the IF triggers and allows the THEN and ELSE to continue to execute. In addition it will save folks from having to write extra programs. I wonder if Michel could get this into 5.x. I know it seems like a trivial change but in reality it could become a big headache.
Tunaman Posted November 10, 2014 Posted November 10, 2014 I'm confused; I thought that was exactly what disabling a program did. Since you can still execute a disabled program then or else, from what I can determine, what disabling does is essentially disable the triggers. However Apostolakisl's results seem to indicate when a currently enabled program disables itself, it has the unexpected result of halting itself. In my mind, I would expect it to continue to execute, but disable the if from being evaluated. So, if a program doesn't have an if (thus, no triggers), I wouldn't expect disabling that program to do anything. Sent from my Nexus 7 using Tapatalk
andyf0 Posted November 11, 2014 Posted November 11, 2014 Maybe it's a bug that execution is stopped when a program disables itself .. Just no ones come across it before
MWareman Posted November 11, 2014 Posted November 11, 2014 +1 for me. Disabling a program should not stop the execution of the IF or ELSE that's currently running. Only a STOP action should do that.
andyf0 Posted November 11, 2014 Posted November 11, 2014 +1 for me. Disabling a program should not stop the execution of the IF or ELSE that's currently running. Only a STOP action should do that. Did you mean "THEN or ELSE"?
apostolakisl Posted November 11, 2014 Posted November 11, 2014 Maybe it's a bug that execution is stopped when a program disables itself .. Just no ones come across it before This is well known and discussed over the years many times. The thing I hadn't ever seen discussed is the fact that an already disabled program does not get halted if a new disable command is encountered. Ideally it would work like that all the time. That disabling a program has no affect on that program should it already be running. It just stops a new trigger. There has been a ton of talk about how to have programs not get re-triggered while running and the current work around is to use 2 programs. But if UD could just make so that "disabling" has no affect on a running then/else, that would also be a good solution allowing you to disable a program from its own then/else then re-enable later on.
MWareman Posted November 11, 2014 Posted November 11, 2014 Did you mean "THEN or ELSE"?Oops - yes. Thanks for the correction!
Recommended Posts
Archived
This topic is now archived and is closed to further replies.