newRPL - build 1255 released! [updated to 1299]
|
04-04-2018, 10:38 PM
Post: #183
|
|||
|
|||
RE: newRPL - build 1001 released! [update:build 1052]
(04-04-2018 07:38 PM)The Shadow Wrote: Hmm. So this will be an automatic feature of all variables? I have mixed feelings about that, depending on how it works. Your example would be like this: You store 1 in A and 2 in B You store 'A+B' in the "definition" property of variable 'C'. Right now the syntax is ugly but I think it works well with the 50g keyboard: Code: 'A+B' 'C...Defn' SPROP Now variable 'C' will contain the value 3, automatically calculated by applying ->NUM to the 'Defn' property. SPROP will also scan the formula 'A+B' (or a program, whatever you provide) and determine which global variables it depends on, in this case 'A' and 'B'. Then it will add 'C' to a property called 'Depn' (dependency) in 'A' and 'B'. This 'Depn' property will hold a list of all variables that depend on a given one, so if this variable change, all variables in the list will be recalculated. A change to 'A' will check if the 'A...Depn' property exists, then go through the list running ->NUM in the 'Defn' propety of each variable. Each variable changed will also trigger other evaluations in the chain. So the variable will hold the result, and the formula will go in a property, much like in a spreadsheet you have the result and the formula as 2 separate things. For the units, I think the property 'Unit' will be a preferred display unit, when displaying in a Form it will attempt to convert to the preferred unit but the stored result will retain the unit in which it was calculated. But... I also included an attribute (did I mention now identifiers can have attributes? anyway...) that is simply a flag "force unit". If this attribute is set, the result will be hard-converted to the preferred unit after automatic evaluation of the formula. You can also "tweak" intermediate values without removing the formula (this you cannot do in Excel, if you write a value, you lose the formula). On your example, if we add: Code: 'C^2' 'D...Defn' SPROP And then we do 5 'C' STO, we are tweaking the value of C, which is an intermediate value resulting from 'A+B' to the value 5, which would recalculate 'D'. This leaves the solution in an inconsistent state, since now 'C' is not 'A+B', but is quite useful when you know what you are doing. All this means one thing: you don't have anything to worry about (un-mix your feelings and relax). If you don't define any 'Defn' properties, your variables will behave like good old 50g, and nothing automatic will ever happen. Also, there will be a global system flag to disable automatic evaluation. And finally, I need to figure out a way to break out of infinite recursion in the evaluation (or this thing will loop ad-infinitum if you create a circular reference in your problem), but I'm close to a solution there. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 10 Guest(s)