Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 28th May 2019, 14:59   #1  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,829
Would someone with an Avisynth wiki account care to correct this?

I don't have an account and I don't know if I'd be able to to it anyway, but there's some incorrect information regarding Avisynth's Eval() here.
http://avisynth.nl/index.php/Block_s...quoted_strings.

Following example #7 it says:

The only disadvantage of the Eval approach is that coding errors inside the string blocks are masked by the Eval() call, since the parser actually parses a single line of code.
Thus, any error(s) inside the blocks will be reported as a single error happening on the above line. You will not be pointed to the exact line of error as in normal script flow. Therefore, you will have to figure out where exactly the error occurred, which can be a great debugging pain, especially if you write big blocks.


The above describes the default behaviour but it can be changed. If an Eval() block is given an identity, in addition to the error message reporting the line number at the end of the Eval() call, the line number within the Eval() block is also reported as though Eval() was a separate script or function.

The default behaviour:
Eval(""" Block Of Stuff """)

To change it:
Eval(""" Block Of Stuff """, "Eval Name")

Near the end of the Import section on the page I linked to, where the differences between Eval() and Import() are explained, there's some info that should be removed or updated.

Debugging is not an issue; every error will be reported with accurate line information.
One useful general purpose application of this implementation is to prototype, test and debug a block conditional branch and then recode it (by adding the Eval() and three-double-quotes wrapper code and removing the global keyword before the parameter's declarations) so that a single script using multiline strings as blocks is created. This workaround compensates for the main disadvantage of the Eval() and three-double-quotes implementation.


And under "Deciding which implementation to use".

For short (up to say 10 lines) blocks, using Eval() and three-double-quotes quoted strings is generally the best solution; it is fast to code and presents a "natural" text flow to the reader (thus it is easy to comprehend).
For long blocks, using any of the other two implementations is generally better because it is easier to debug.


The error reporting is mentioned in the final Eval() example on the Control Structures page, but I think the purpose of "name" should be included in the description too.

Eval(expression [, string name])

Cheers.

PS. Would there be a reason not to change the default behaviour for Avisynth, or for Avisynth+?
If the Eval() call isn't named, could a generic one be used by default? Before someone pointed out the error message is more specific when Eval() is named, I'd banged my head against the desk numerous times while trying to find the cause, but ideally Avisynth would always include the problem line number within Eval() too, given it obviously can.

Last edited by hello_hello; 28th May 2019 at 15:45.
hello_hello is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 21:28.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.