Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Login


Options
Go to last post Go to first unread
Offline Davide Carpi  
#1 Posted : 28 May 2012 19:32:39(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,647
Man
Italy
Location: Italy

Was thanked: 1329 time(s) in 875 post(s)
Hi,

another little bug, I think...

bug eval() vs loops

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 consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects

Wanna join the discussion?! Login to your SMath Studio Forum forum account. New Registrations are disabled.

Offline TheWizEd  
#2 Posted : 29 May 2012 03:26:29(UTC)
TheWizEd


Rank: Advanced Member

Groups: Registered
Joined: 04/07/2010(UTC)
Posts: 178
Man
United States

Was thanked: 19 time(s) in 13 post(s)
w3b,

I can't explain the error but I don't understand the eval()s. eval() is the same as "=".
Ed
Offline Davide Carpi  
#3 Posted : 29 May 2012 07:15:51(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,647
Man
Italy
Location: Italy

Was thanked: 1329 time(s) in 875 post(s)
Hi WizEd Good

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 Biggrin )


regards,

w3b5urf3r

Edited by user 29 May 2012 10:18:45(UTC)  | Reason: Not specified

If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects
Offline mkraska  
#4 Posted : 29 May 2012 20:14:28(UTC)
mkraska


Rank: Advanced Member

Groups: Registered
Joined: 15/04/2012(UTC)
Posts: 1,986
Germany

Was thanked: 1124 time(s) in 721 post(s)
Originally Posted by: w3b5urf3r_reloaded Go to Quoted Post
Hi,

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.

eval(for)

Best regards, Martin Kraska
Martin Kraska

Pre-configured portable distribution of SMath Studio: https://smath.com/wiki/SMath_with_Plugins.ashx
thanks 1 user thanked mkraska for this useful post.
on 29/05/2012(UTC)
Offline Davide Carpi  
#5 Posted : 30 May 2012 01:11:53(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,647
Man
Italy
Location: Italy

Was thanked: 1329 time(s) in 875 post(s)
hi mkraska,

Thank you! I agree with your analysis Good

probably the use of eval() in the left side is not conventional, however the error message is quite obscure, I think Wonder ...

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

Edited by user 30 May 2012 10:52:55(UTC)  | Reason: Not specified

If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.