1 Pages (5 items)
eval() and for/while loops - Messages
#1 Posted: 5/28/2012 12:32:39 PM
Hi,
another little bug, I think...

note that the results are right (also for bigger scripts inside the loop)
here is the file in the example: bugs%2feval_for_0.94_debug.sm.zip
regards,
w3b5urf3r
another little bug, I think...

note that the results are right (also for bigger scripts inside the loop)
here is the file in the example: bugs%2feval_for_0.94_debug.sm.zip
regards,
w3b5urf3r
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#2 Posted: 5/28/2012 8:26:29 PM
w3b,
I can't explain the error but I don't understand the eval()s. eval() is the same as "=".
I can't explain the error but I don't understand the eval()s. eval() is the same as "=".
Ed
#3 Posted: 5/29/2012 12:15:51 AM
Hi WizEd 
eval() speeds up the calculations (<10 seconds vs 20,30 seconds or minutes, if i remove all eval()s from entire script... i don't know how, but works :d )
regards,
w3b5urf3r

eval() speeds up the calculations (<10 seconds vs 20,30 seconds or minutes, if i remove all eval()s from entire script... i don't know how, but works :d )
regards,
w3b5urf3r
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#4 Posted: 5/29/2012 1:14:28 PM
WroteHi,
another little bug, I think...
Hi,
I am not sure if that is a bug or a feature. My theory on eval is that it enforces immediate evaluation when used on the right hand side of assignment operations. In your example, however, there is no assignment of the eval result. eval just tries to evaluate the statements inside the line operation and as a last step tries to determine the return value of the line operation (which is normally the value of the last line).
The last line, in your case, is a for statement, which is just a flow control statement and seems not to have a return value on it's own. Therefore, the last line has no return value and eval complains.
I may be totally wrong, still just providing any other line at the end resolves the error message.

Best regards, Martin Kraska
Martin Kraska
Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
1 users liked this post
Radovan Omorjan 5/29/2012 2:41:00 PM
#5 Posted: 5/29/2012 6:11:53 PM
hi mkraska,
Thank you! I agree with your analysis
probably the use of eval() in the left side is not conventional, however the error message is quite obscure, I think o_o ...
for the visual error I had done differently, moving the eval() inside the for loop... in addition to eliminating the red border seems to be slightly faster, although I do not understand why (hundreds of eval() instead of one...)
best regards,
w3b5urf3r
Thank you! I agree with your analysis

probably the use of eval() in the left side is not conventional, however the error message is quite obscure, I think o_o ...
for the visual error I had done differently, moving the eval() inside the for loop... in addition to eliminating the red border seems to be slightly faster, although I do not understand why (hundreds of eval() instead of one...)
best regards,
w3b5urf3r
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
1 Pages (5 items)
-
New Posts
-
No New Posts