Negative requirements: nreq vs. "negate" TRUE/FALSE

Contribute, display and discuss rulesets and modpacks for use in Freeciv here.
User avatar
Alien Valkyrie
Elite
Posts: 513
Joined: Sun Feb 10, 2013 10:21 pm
Location: Stuttgart, Germany

Re: Negative requirements: nreq vs. "negate" TRUE/FALSE

Post by Alien Valkyrie »

nef wrote:
Caedo wrote: Also, I believe the "negated" (and then "present") aren't supposed to be something additional, but a way to generalize and abstract the requirements system, which makes both it and anything dealing with it (such as AI) clearer and less error-prone.
I think it is clear enough that the changes 2.4 -> 2.5 -> 2.6 are entirely cosmetic (i.e. syntax only). The first change (2.4 -> 2.5) was to unify the syntax between the effects file and all the others. The second change (2.5 - 2.6) was to deal with human frailty concerning double negatives.
Ostensibly, yes, at least on a ruleset level. On a code level, however, the old code essentially had to separately evaluate the reqs and nreqs for an effect (and they work slightly differently) with the same data, meaning that (a) you had almost the same code twice, which creates redundancy in the code, and (b) whenever something about the requirements system was changed, it became necessary to make a whole bunch of little changes in a whole bunch of places, which is more work, so the whole system was more prone to accidentally introducing errors.
Now, I wasn't able to figure out if something like that ever happened (digging through code you don't know well with only github's web interface is cumbersome), but either way, eschewing nreqs to create one unified requirements system in 2.6 removes this additional work and risk for the future by creating clean, compact code (unifying three methods that were each essentially a dozen lines of hot air into one method that did it all concisely).
Why yes, I am studying to become a software engineer, how could you tell?
~ AVL
nef
Elite
Posts: 324
Joined: Mon Jun 25, 2018 5:01 pm

Re: Negative requirements: nreq vs. "negate" TRUE/FALSE

Post by nef »

I should have been a little more careful with my words. I was referring only to those of us who use/hack the ruleset files. Changes to the c code for maintainability purposes is an entirely different matter and is immaterial to those of us who are not up to maintaining the code (provided it works and doesn't break). I was a little too casual about the distinction.

As for the rationale for the changes my only comment would be 'what took so long'. The simplicity of 2.6 style is/will be much preferred by ruleset authors (and c coders, alike).

Also I seem to be a little confused about the 2 part sequence. Both changes are documented in category page http://freeciv.wikia.com/wiki/How_to_up ... 2.5_to_2.6 but there is an obscure reference in http://freeciv.wikia.com/wiki/How_to_up ... 2.4_to_2.5 for the first step. The 2.5 rulesets that I have checked are unchanged so the 2.4 -> 2.5 category page text may have been a slip.
Corbeau wrote:I understand the "nreqs" thing is going to be obsolete and replaced by "negate" TRUE/FALSE. So, I tried this:
This was the post that started all this, and it appears that it worked (after the typo was fixed)??? No release was mentioned but the implication is that I may have been correct with the 2 part sequence. Corbeau can you clarify this point?
User avatar
Corbeau
Elite
Posts: 1292
Joined: Mon Jan 13, 2014 11:13 pm

Re: Negative requirements: nreq vs. "negate" TRUE/FALSE

Post by Corbeau »

Right. Sorry, I didn't check it, I reverted to nreqs to move on and finish things up and never returned to check the typo.
--
* Freeciv LongTurn, a community of one-turn-per-day players and developers
* LongTurn Blog - information nexus with stuff and stuff and stuff
* Longturn Discord server; real-time chatting, discussing, quarrelling, trolling, gaslighting...
Post Reply