[Xotcl] Announcement: Next Scripting Framework 2.0b5 available
Gustaf Neumann
neumann at wu.ac.at
Mon Jun 10 14:12:05 CEST 2013
Dear Community,
Since the last release of the the Next Scripting Framework
(NSF 2.0b3), we have received feedback from early adopters.
Many thanks for the helpful and the constructive comments!
This feedback triggered an internal discussion and led to
revising
some earlier design decisions and naming conventions,
especially
in NX. The new naming conventions improve the orthogonality and
the clarity of NX programs.
Since the release of 2.0b3, there have been more than 250
commits to
our code repository. The implementation is very stable and
has been
used for more than two years in production of our large-scale,
multi-threaded web environment inside NaviServer. Most of
the changes
happened in NX and, therefore, on the NSF scripting level,
without the
need to modify the NSF C layer. The implementation of XOTcl
2 has
changed very little. The Next Scripting Framework was tested
with Tcl
8.5.14 and Tcl 8.6.0 on Linux, Mac OS X, and in windows
environments
(MinGW, VC11).
This beta-release is supposed to be the last release before
the final 2.0 is out, which should be soon.
Below are the most notable differences in 2.0b5 as compared to
2.0b3:
a) NX 2.0b3 used the following conventions to define methods for
instances, object-specific methods and class-object specific
methods:
/cls/ method foo {args} {...}
/obj/ method bar {args} {...}
/cls/ class method baz {args} {...}
Introspection was possible via (in the same order):
/cls/ info methods
/obj/ info methods
/cls/ class info methods
The problem with this convention is that e.g. "info methods"
operates on different method records, depending on
whether it is
called on a class or on an object. This breaks a basic
inheritance
contract with the programmer: As nx::Class is a
specialization of
the most general class nx::Object, the same
introspection operation
(e.g., "info methods") should return e.g.
object-specific methods
for both class objects and ordinary, non-class objects.
Therefore, we adopted the following more orthogonal
conventions to define methods for instances and
for object-specific methods
/cls/ method foo {args} {...}
/obj/ object method bar {args} {...}
Introspection:
/cls/ info methods
/obj/ info object methods
Note that we can now use the same mechanism to define
or query object-specific methods on objects and classes.
The same applies for aliases, forwards, mixins, and filters.
The new convention imposes a little typing burden for
the code
writer, but reduces the potential ambiguity for the code
reader,
who is trying to understand what exactly "$x method FOO
{args}
{...}" means.
For convenience, we provide two packages
"nx::plain-object-method"
and "nx::class-method" to switch to the old conventions.
A verbose
tracing mode can report usages to ease migration.
b) Parametrization:
NX 2.0b3 followed the XOTcl conventions of registering
by default
same-named getter/setter methods for configuration
parameters used
in object creation. These getter/setter methods bloat
the method
interface and risk shadowing inherited methods, leading to
unexpected behaviors for beginners.
NX 2.0b5 adopts a Tk/itcl/... idiom by offering a
cget/configure
interface to objects as generic getters/setters. To obtain
parameter-specific getters/setters (i.e., the old
behavior), the
flag "-accessor public|protected|private" can be set
when defining
properties and variables.
c) Further clean-ups of the introspection interface ("info").
In order to streamline the interface further, we
followed the idea
to use "... info /plural word/" to obtain a set of
handles, and
then to make a separate call to retrieve the details.
Therefore, we
now provide ...
/cls/ info methods
/obj/ info object methods
/cls/ info variables
/obj/ info object variables
/cls/ info slots
/obj/ info object slots
/cls/ info method parameters /methodName/
/obj/ info object method parameters /methodName/
/cls/ info configure parameters
/obj/ info lookup configure parameters
... to return a list of handles. The result list can be
filtered in
each case by specifying a match pattern. Each result
handle can
then be used in a separate call to obtain details:
/obj/ info method definition /methodHandle/
/obj/ info variable definition /varHandle/
/obj/ info parameter name /paramHandle/
These are just a few examples.
In NX 2.0b3, we had e.g. "... info parameter definitions
..."
leaving a beginner in the dark about the parameters actually
meant. Also, the introspection interface made mixed use
of plural
and singular wordings for different purposes (e.g.,
retrieving
collections and/or detailed information on one item).
Below is a more detailed summary of the changes.
The Next Scripting Framework 2.0b5 (containing NX and XOTcl
2.0b5) can
be obtained from http://next-scripting.org/
Best regards
- Gustaf Neumann
- Stefan Sobernig
===============================================
Announcing NSF 2.0b5
*************************
Major changes relative to NSF 2.0b3 are (in addition of
the items (a), (b), and (c) above) are:
* Additional Features:
- Serializer:
* Added flag -objmap to Serializer method deepSerialize
to make serializer to provide mapping only for
object names. This makes the serializer
usable for object/class copying (-map is too coarse)
* Made "ignore" method public
* Due to the split between serializer and object
system serializer, the "ignore" settings were lost
- Allow explicit unsetting of -per-object flag in
0-argument
"-flag=value" notation (all built-in commands accepting
this flag)
- Better compatibility with XOTcl 1.*:
- Added "/obj/ info name" (as alternative to
"namespace tail [self]")
- Test-suite: added summary with statistics
- Traits: added property/variable inheritance
- MongoDB
- Added "nx::mongo::db drop collection /name/"
- Returning status from "nx::mongo::db remove" as
success (0 or 1)
- Adjust to object interface
- Reduce verbosity
- Add error messages for slot lookup failures
Updated MongoDB interface
- Upgraded to c-driver 0.7.1
- Zested with MongoDB 2.4.4-pre
- New commands:
* mongo::run
* mongo::cursor::find
* mongo::cursor::next
* mongo::cursor::close
- Adapted interface for c-driver 0.7.1 (e.g. new
optional name for mongo::index)
* Improved Code Quality:
- Fixed functional bugs:
* Copy did not copy aliases and ensemble methods
* Automatic object destroy for half-baked objects
(when e.g. configure raises an exception)
* Handling of required configure parameters
on later calls to "configure"
* Fixed potential infinite loop in pattern matching for
precedence lists
* Handling of full-qualified name patterns
for private slots
* Invalidation of per-object parameter cache
- on mixin changes and
- on deletion/adding of per-object slots
* Handle cyclical superclass/class dependencies
during object
system finalize
* Fixed a bad interaction between Tcl's apply
(pushing lambda
frames) and the variable resolvers. The variable
resolver was
not able to resolve variables, while the command
resolver was
still working correctly.
* Don't allow "method" to overwrite child objects
- Fixed potential crashes:
* Avoid crash on object destroy, when the same
wrapper-less
aliases was registered on more than one object/class
* Fix crash on "nsf::my", when this is called with a
single
argument outside an object context (many thanks
to Markus Moser for reporting)
* Avoid crash in case NsfParameterGetCmd() is passed
a plain value (without a parameter spec)
* Fix potential crash in method caching when commands
are renamed by Tcl (many thanks to Arthur Schreiber
for reporting)
- More code cleanup and refactoring
- Released version runs all regression tests
without memory leaks with Tcl 8.5.14 and
Tcl 8.6.0
- Build system:
* Improved compatibility for windows compilations.
NX can now
be compiled under windows with the native window
tool chain
(VC11) and as well with MinGW (Many thanks to Stephan
Adelsberger)
* Update to latest TEA
* Follow new naming convention for auto-tools
(using configure.ac)
* Fix compilation when DTrace is activated (missing
parenthesis, many thanks to Victor Guerra for
noticing)
* Added compile macro NSF_STACKCHECK to provide stack
monitoring/debugging (especially useful for multi-
threaded programs, where stack is more limited)
- Fix compilation when compiled without threads
(many thanks for r.Zaumseil for noting this)
* Improved documentation
- Fixed typos, improve wordings
- Updated tutorial and migration guide
- Use slashes in generated syntax to distinguish
between constants and placeholders.
Example:
/obj/ info method definition /methodName/
* Extended regression tests
MORE INFO
General and more detailed information about the
Next Scripting Framework and its components can be
found at http://next-scripting.org
More information about the Xotcl
mailing list