Forum: Cfengine Help Subject: Re: evaluation of variables Author: mark Link to topic: https://cfengine.com/forum/read.php?3,18954,18964#msg-18964
Gentlemen, yes, this is partly my sense of ironic humour at work. It seemed easier than getting into a discussion about it, but I should have known better, so let me explain further. A few points: 1. Be careful with svn updates. I do not see find being executed 16 times when I try your example. It happens once during parsing and once during execution. Though the file gets stat'ed several times. Perhaps you were unlucky to get a subversion commit that was in flux. Some work has been done on variables. (Even if it did happen 16 times, cfengine is quite fast compared to any of the other programs out there.) 2. It can be legitimately necessary to execute a function call several times in order to reliably converge values when evaluating variables. Lazy evaluation is only good if it saves you from work, not if it doesn't get the work done at all, and all algorithms suffer from that possibility. This is actually a difficult problem, as you can't lock or cache functions and expect to get the correct result in general in a dynamic environment (unlike logic programming, cfengine's run environment is not static) -- one of the reasons the manual page warns against using execresult too much. The reasons are "technical" (he says dismissively) and have to do with possible parameterization of the command with other variables that are defined by classes that are defined by variables that... etc. I'd rather not get into that. 3. So the joke about joke (you might want to change your name) was an association with the old Groucho Marx story: joke: "Doctor, doctor -- it hurts when I do this to my sister cfengine: execresult("/usr/bin/find /etc/cfengine3/packages -name '*.cf' -printf %p\n", "noshell"); " sister cfengine: whrrrrrr.... doctor: "Maybe you shouldn't do that..." joke: "Are you crazy? She's just badly designed! Look, if I run this through my portable X-ray machine I found on the internet, I can see that this machine has 2 eyes, 2 legs, 2 lungs.... what is the meaning of this pointless redundancy?" Seva: "If I'd known this at the beginning, I never would have married her!" ;-) <------- _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine