Rank: Administration Groups: Registered, Advanced Member Joined: 23/06/2009(UTC) Posts: 1,740 Was thanked: 318 time(s) in 268 post(s)
|
Thank you Andrey, Let me get this straight in order to figure out how would that be working. This is the bahavior in v0.90 which is a bug introduced due to new animate feature: x←1 d←8f(xVar)←line(xVar←xVar+5,d←7,mat(xVar,d,2,1),3,1)f(x)=mat(6,7,2,1)x←1 xVar←#d=71. Global variable "d" has changed from 8 to 7 (after F9) and it should not be this way - wrong. 2. Variable "x" is a real function argument in the function call and the global variable with the same name "x" has not change - correct. 3. Variable "xVar" is a variable in the function definition list and is changed inside the function definition. It is not known outside the function definition. Now, let me do sam [FACKED] examples by changing the output here in the forum (this is not an actual output from v0.90) - The fixed first example should give this output - if I was right? x←1 d←8f(xVar)←line(xVar←xVar+5,d←7,mat(xVar,d,2,1),3,1)f(x)=mat(6,7,2,1)x←1 xVar=6d=8 1. The global variable "d" has not changed in spite of changing the local variable with the same name inside the function definition - correct. 2. The new global variable "xVar" has been defined inside the function. 3. The variable "x" as an argument in the function calling has not been changed - correct- The fixed second example should give this output - if I was right? x←1 d←8f(x)←line(x←x+5,d←7,mat(x,d,2,1),3,1)f(x)=mat(6,7,2,1)x←6 d=8 1. The fictive argument "x" will be changed only if there are the same name of arguments in the function definition (and changed inside the function body) 2. Any other variable which are defined locally (including the same name as outside the definition) and not present in the function definition list will remained unchanged I hope I am right about all of this. If not, please let me know. However, if this is working as described I think this would be just fine. However I think that I was not right about this ant the real changes are like this: x←1 d←8f(xVar)←line(xVar←xVar+5,d←7,mat(xVar,d,2,1),3,1)f(x)=mat(6,7,2,1)x←6 xVar←#d=81. Argument "x" has changed because its changing inside the function definition (passing by reference) 2. Variable "d" has not changed due to the locally definition inside the function body. This behavior is also acceptable. If the "passing by reference" is introduced there is a trick if we do not want to change the real function argument - by passing something like "1*x" or "0+x" instead of "x". At least I hope it will work that way - not sure. The worst thing would be if we allow the variable "d" to be changed inside the function body and retain its value afterwards. I think there are no to many situation where we need to change the function arguments in the function definition. One of this situation is in recursive function calls. I am not quite sure about its working in v.0.90. (see this post please recursive function call) On the other hand, I see for the first time this in the tooltip (using numerical equal to) [FACKED] line(arg=30,param=40,2,1)there were always symbolical equal to in the tooltips or the Dynamic assistance. line(arg—30,param—40,2,1)Is there any new feature there introduced maybe? Regards, Radovan Edited by user 15 January 2012 04:40:06(UTC)
| Reason: Not specified |
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!" |