Changes in NSF 2.2.0

 
Dear Community, We are pleased to announce the availability of the Next Scripting Framework (NSF) 2.2.0. The changes are mostly performance and robustness improvements, providing better error messages etc. See below for the details. Diff stats since 2.1.0: 214 files changed, 54192 insertions(+), 44982 deletions(-) Major changes relative to 2.1.0 are: New Features - NSF: * Robustness improvements: + Use exactly the same six whitespace-delimiter characters in NSF as in plain Tcl to avoid surprises (internal API: NsfHasTclSpace()) + Improved parameter parsing: Don't allow bytearrays as name of non-positional arguments, to avoid that bytearrays get unwanted string representations (and losing potentially the pure bytearray property). This could lead to problems with newer Tcl versions when passing binary data to NSF procs and methods. * Performance improvements: + coloncmd reform: Dispatch performance of [:myMethod ...] is improved by up to 30% by caching the result of the method lookup in a Tcl_Obj + Lookup of (bytecode-compiled) object variables is now performed via a sorted lookup cache to avoid repeated linear searches for compiled locals (especially an improvement for unsuccessful searches). + Reduced number of string comparisons (strcmp()) via first-char comparison in method-parameter parsing and argument handling. + Reduced number of strlen() operations, especially in method-parameter parsing and argument handling. + Reduced memory consumption via better member aligning of structs, esp. on 64-bit machines. * New, low-level helper command: * "::nsf::definitionnamespace": Determines the default namespace for objects etc. as used internally in NSF * "::nsf::cmd::info disassemble /methodName/", "/cls/ info method disassemble /methodName/", "/obj/ info method disassemble /methodName/": This is the pendant to ::tcl::unsupported::disassemble adding support for NSF methods and NSF procs (nsf::proc). See, e.g., https://wiki.tcl.tk/21445. The "info" methods are only available when NSF has been built using --enable-development. - NX: * Improvements to incremental property methods: Adding ("value=add") and deleting elements ("value=delete") now enforce any value checkers defined on their properties and behave correctly when conversion is used. * Improvements to handling of parameter option "substdefault". NX provides now controls to the developer to select the kind of substitution at runtime when a default value is used. + the "substdefault" options can control via a single argument whether command/variable/backslash substitution is wanted. Examples: 0x111 substitute all 0x100 only command substitution 0x010 only variable substitution 0x001 only backslash substitution or any bit combination. Combinations can be used to define the equivalents of the flag "-nocommands" (0x011), "-novariables" (0x101), "-nobackslashes" (0x110), and their mixes, respectively, available to [subst]. + make behavior of per-object and per-class substdefaults consistent, early check for complete substitution scripts. * Improvements to ensemble methods: + Fixed bug when ensemble method was dispatched via colon dispatcher (problem with leading colon) + [current nextmethod] + [current isnextcall] return now proper ensemble methods when necessary - MongoDB interface upgrade: * Upgraded driver and utilities to mongodb-c-driver 1.12.0 and libbson 1.12.0. * Add regular expression queries to conditions in nx::mongo * Improved portability between platforms/ OS * Added auto-cleanup of resources (objects) for long-living execution environments (destroy_on_cleanup). * More robust serialization of object graphs, by preserving original classes in serialization/deserialization. * Fixed default-value handling under certain conditions - nx::test: * Provide support for expressing expected results in terms of error codes, rather than error messages. This is to prepare an upcoming reform on providing error codes from within NSF more extensively. - nx::serializer: * Fix potential problem in NaviServer ns_eval with blueprint updates on objects, which were not created by the blueprint. Such objects could lose their classes when these classes are cleaned up on blueprint evaluation. - DTrace support (macOS): Adjusted NSF/DTrace integration for changes on recent macOS (incl. SIP). See dtrace/README for instructions. - Documentation: * NSF now has support for TIP #59 introspection via ::nsf::pkgconfig; see https://core.tcl.tk/tips/doc/trunk/tip/59.md * Added tutorials on NX properties: tutorial-properties.tcl * Improved spelling in documentation: next-migration.txt etc. - Continued testing: NSF is now continuously built and tested under Linux, macOS, and Windows against different Tcl targets, using different tool chains (gcc, clang, MinGW, MSVC). For this purpose, there is now an official GitHub mirror at: https://github.com/nm-wu/nsf Build and test reports are available from: https://travis-ci.com/nm-wu/nsf https://ci.appveyor.com/project/mrcalvin/nsf-2ylk0 - Maintenance & bug fixes: * Execution namespace reform: As in earlier releases, NSF methods can execute in different namespaces such as their object's definition namespace. Starting with NSF 2.2, the execution namespace is maintained in a context structure and the namespace is just changed while the proc is executing. This fixes some counter-intuitive results using standard Tcl introspection on these commands. * Migration to C type 'bool': replace legacy 0/1 integer bools by proper types when possible. * Tcl 8.7: Support for Tcl 8.7a1 and the upcoming, unreleased Tcl 8.7a2 (core.tcl.tk branch "core-8-branch"). NSF compiles and its regression tests execute successfully. * Misc (esp. NSF/C): + Bug fix: Avoid preemptive frees on %proc substitution for forwarder methods. + Aliases: Avoid Tcl_obj re-creations + Guarded against potential Tcl_Obj leaks, esp. when using "NsfMethodNamePath", as indicated by valgrind. + Silenced warnings emitted by GCC 8.1+ on strncat() and strncpy(). + Addressed 5 code-quality issues as indicated by Coverity Scan, incl. control-flow issues (risking NULL dereferencing) and buffer overflows in string operations. + Silence warnings under MSVC 1914 * New configure option: "--enable-development=test" Enable computationally intensive runtime tests, having noticeable effects on runtime. A version of NSF configured with "--enable-development" can be used also for production environments. * Extended regression test suite: The test suite contains now 6243 tests (for Tcl 8.6.8). This compares with 5852 tests in NSF 2.1.0 (for Tcl 8.6.6). - Packaging & distribution: * Initial support for the new nmake system of TEA (TIP 477) and MSVC 1914 (VS 2017; win/makefile.vc); various fixes to install target. The detailed changelog is available at https://next-scripting.org/xowiki/download/file/ChangeLog-2.1.0-2.2.0.log The Next Scripting Framework 2.2.0 (containing NX 2.2.0 and XOTcl 2.2.0) can be obtained from https://next-scripting.org/. Please report issues and wishes by opening a ticket at https://sourceforge.net/p/next-scripting/tickets/. Best regards - Gustaf Neumann - Stefan Sobernig