Expression Too Complex - some details?
If possible, I'd like to know exactly how MMF decides an expression is too complex.
I've got a few things worked out. Someone please correct me if these are wrong:
Strings
Each string in an expression must have 256 characters or less, not including the delimiting " characters.
This can be resolved by splitting a long string up, like this:
"String A" + "String B"
In this case, both strings A and B can have up to 256 characters, making the a total string of 512. This works from within the same expression.
Integers
There appears to be a maximum of 61 integers per expression, assuming no brackets. So if you do 1+1+1+1...+1+1, you can have a total of 61 '1's.
A set of brackets will take the place of 1 integer
But it doesn't always seem to fit, so if someone could explain a few more of the rules about long expressions, that'd be dandy :)
Re: Expression Too Complex - some details?
I believe there is a character limit but Francois would know for sure as this is his area.
Re: Expression Too Complex - some details?
very, interesting... and weird.
Re: Expression Too Complex - some details?
Yes there is a buffer limit (the compiled expression buffer). Can you post your expression? I am surprised that this limit can be reached...
Re: Expression Too Complex - some details?
I reach it often at the moment, everytime when i try to soften something by the surrounding knots. 9 Values to calculate. And have posted one example expression before:
http://reinerstileset.4players.de/ex...oocomplex2.jpg
Re: Expression Too Complex - some details?
I frequently get this problem as well... normally when executing an SQL statement
Re: Expression Too Complex - some details?
I get this problem very often with SQL queries too. Maybe having many double and single quotes mixed lead to a problem ?
Re: Expression Too Complex - some details?
It's a very common problem in complex expressions. I use immediate if statements a lot because they help work around object selection problems without fastloops, and this error can be very common once you have nested ifs.
Another thing you can do is use a nested min() function to retrieve the lower of five or six variables. If each variable is derived in a complex way, it can easily get too much. You end up having to create a bunch of alterable values to handle it.
But that said, it can still take a long expression. This is valid:
Quote:
min((CompareIntegers("Immediate If Object",find(edittext$("Edit Box"),"+",pointer("VARS")),">",-1,find(edittext$("Edit Box"),"+",pointer("VARS")),len(edittext$("Edit Box")))),min((CompareIntegers("Immediate If Object",(find(edittext$("Edit Box"),"-",pointer("VARS"))),">",-1,(find(edittext$("Edit Box"),"-",pointer("VARS"))),len(edittext$("Edit Box")))),min((CompareIntegers("Immediate If Object",(find(edittext$("Edit Box"),"/",pointer("VARS"))),">",-1,(find(edittext$("Edit Box"),"/",pointer("VARS"))),len(edittext$("Edit Box")))),(CompareIntegers("Immediate If Object",(find(edittext$("Edit Box"),"*",pointer("VARS"))),">",-1,(find(edittext$("Edit Box"),"*",pointer("VARS"))),len(edittext$("Edit Box")))))))
That finds the location of +, -, * or /, whichever comes first in a string.
Btw, that was generated by Expression Editor Plus, which is designed to help you code complex expressions. I want to know how MMF picks up errors so I can warn about them before exporting the expression.
EG. If an expression it generates will result in an 'Expression too Complex' error, I'd like to be able to process the string and find out why, and maybe make some suggestions on reducing it. Like "You've used a long string - try containing this in a string object and refering to it like in the following example:..." or "Your expression is simply too complex. MMF has a buffer limit. Would you like to use a wizard to split your expression in two?"
...that kinda thing.