Include does not work well for me.admin wrote:I plan to officially release functions and include in 15.20. The features work alright for everybody now? (Not asking for extra wishes -- those will come in phase 2.)
Mainly because of this:
Code: Select all
v15.00.0507 - 2015-04-26 12:58
. . .
+ Scripting: Now Include statements can be nested (included files can
themselves include other files). The maximum nesting level for Include
statements is 100 (one hundred). You will get an error if you go beyond.
Beware of recursion: **A file must not include itself or any file by which
it has been included**, else you will reach the maximum nesting level within
the next millisecond...
If I have two include files which rely on functions within each other there's no good way to get it to work.
Unfortunately, you complicated it further with these bizarre changes:
Code: Select all
v15.00.0523 - 2015-05-02 14:58
. . .
* Scripting: Now include, function, and namespace statements can be indented.
- Makes scripts look better.
- Included stuff will now inherit the indent of the include statement. Can
make a difference in multiscripts.
As far as I can tell this will never work given the current behavior...
ArgIs.inc:
Code: Select all
include String.inc
namespace ArgIs
function Integer($arg) {
return ($arg == 0) || ($arg\1 == $arg);
}
function EmptyString($arg) {
return String::IsEmpty($arg);
}
Code: Select all
include ArgIs.inc
namespape String
function Repeat($str, $repeat=0) {
Assert ArgIs::Integer($repeat), 'Repeat must be an integer.';
Assert $repeat >=0, 'Repeat must be non-negative.';
return StrRepeat($str, $repeat);
}
function IsEmpty($str) {
return $str == '';
}
Code: Select all
include String.inc
"Repeat"
echo String::Repeat('Hello', 2);
Also, reusing a popular extension in 'inc' is a terrible choice in my opinion - 'xyi' or 'xysi' would be better.