Comments in RM

Well, be careful on terminology... It won't "hang" forever. It isn't a single thread, single execution issue, as that isn't how rep works in this context.

But to Bert's point, depending on the trigger you may keep ending up in the rep portion of the if statement.

Yaeh, I agree with you :wink:

My code or rules are more complex. Just to be as exhaustive as possible I show a short sequence of my codes here. You can easily see that there are more ramifications possible, but I will not show all of them to non overload the post (maybe already the case).

Here is a date and time trigger that sets two SetPoints for Heating:


(The last action line is a work around as variable triggering does not work correctly with day conditions - another post)

This rule is triggered by the change of one of the variables set by the rule above:

This is the rule run by the above script if a window is open:

Opening or closing a window triggers this rule that triggers again the above rule:

To avoid that the called rule 1100(A) is triggered multiple times when a window is opened and closed in a short period (to call someone for example or a door) I have a delay of 1 minute and to avoid the rule to run on multiple instances I use the private boolean. If the state after a minute is the same as the old one (set on the valves) all instructions in rule 1100(b) will be skipped

Ok, I agree. This instance of the rule will hang forever in the loop, until restarted, power failure and so on :wink:

Again, it still depends on what the trigger is and whether condition X would always evaluate as true or not. But now I'm just arguing because I'm bored, so I'll stop. :slight_smile:

1 Like

:popcorn:

@pascal.nohl i appreciate your thoughtful comments.

In case anyone missed it, I did implement comments last night. I don't like them, wouldn't use them, suggest that you not either, but they are there.

Your comments about how RM works reveal that you don't understand how it works. There is no "core service", there is no translation, there is no "interpreting" rules or lines beginning with characters, "//" or otherwise. @bertabcd1234 explained pretty clearly above what is going on. Selected actions are executed against selected devices and settings, conditions are evaluated with then current values of devices, variables and settings, not "before" anything. They are also evaluated as the rule is built in order to display their current values at that time, and then evaluated when encountered as the rule runs, where those values could be visible in logs (of which you are in control of there being too many or not).

RM is not a programming language, by any "modern" definition.

A programming language is a formal language comprising a set of strings that produce various kinds of machine code output. Programming languages are used in computer programming to implement algorithms. Most programming languages consist of instructions for computers.

There are no strings involved, it produces no machine code. There is no "interpretation", no "translation", as there is no script or source code to interpret or translate, no object code to execute. RM provides a means to implement an algorithm, so in that sense it has a certain similarity to a programming language. It is an interactive app that creates data structures that determine actions to be performed in response to events, as are all of the built-in apps that run on the hub.

The newly implemented Comment feature is not ignored as a comment in programming language "source code" is; it's an action like any other RM action, where the method that implements it does nothing. Like all actions, it resides in the data structures of a rule, with, unfortunately but unavoidably, two copies of the comment string (tldr explanation as to why there is a copy as well as the original having to do with speed of page rendering during rule creation).

6 Likes

That may be true, I don't know the logic, didn't see the code and I have to estimate as long as I have no concrete information.

BUT, you say there is no interpretation and that's simply not possible. Regardless of the way it works, you have some user readable rules, scripts or whatever you call what we see when rules are defined and this has to be interpreted to your logic and back (or return the stored original value) if a rule is edited again. So there is an interpretation at some levels. It doesn't even matter if I understand it or not.

Anyway, that's not my job and as you created comments over night, it might not have been so impossible or hard as announced...

Obviously in retrospect that was true. But that doesn't mean that the original statement wasn't believed to be true at the time.

Another possibility is that like many engineering oriented minds, over time he looked at/thought of it a different way and came up with an idea that was much easier to implement than what he believed to be required/the original idea.

New thoughts and new ideas equal new outcomes after all. :slight_smile:

Just a thought/suspicion. I could be completely off base.

1 Like

As I said above, I don't like this idea at all, and didn't want to do it. It's all just SMOP ultimately.

2 Likes

I fully understand that. I always start my software (not valid for on demand developments) with something I need for myself. Later users request one or the other feature that I don't need, do not want, do not like and that from my logical point of view is not a good idea to implement. But if the user demand is important enough, I simply do it.

What do you mean with SMOP ?

  • Simple Matter Of Programming
  • Standard Method of Procedure
  • Small Matter of Programming :wink:

Will it be in the next release ?

No worries. Your baby, your decision. :slight_smile:

I actually think I will use the feature on occasion. :man_shrugging: I wasn't losing any sleep about it not being there, though either - so I'm not complaining either way.

You can put an entire book in a comment if you want:

And like all actions, they can be delayed (whatever that means).

2 Likes

(smart arse jason now wants to see if Bruce's head will explode)

Can we embed HTML tags or links in there? Pictures?

(jason runs for cover before getting banned)

2 Likes

You can try, but nothing ever touches that text. It's not processed in any way by anything.

Any bidders for GOTO? I know how to do it, and it would take maybe 15 minutes...

Add things like GOTO and we'll get some seriously F'ed up and impossible to troubleshoot rules in no time!

:wink:

1 Like

Almost ready....

And....

That should be no problemo....

1 Like

Wouldn't that make an infinite loop if it were Wednesday?

Or would it not go from 2 back to 12 after 2 completed?

Only until Thursday, but I suspect it might barf on trying to pop an empty IF-THEN list

Of course, I could suppress such barfing with a try-catch, and just let er rip.

2 Likes

No, it's GOTO, not GOSUB.

1 Like

My head hurts now.

I would have thought - 12 --> 2 --> 3 --> 12 on a GOTO.