| |
1 |
1 |
Dear Community, |
| |
2 |
2 |
|
| |
3 |
3 |
Since releasing the Next Scripting Framework (NSF) 2.0b3, we have |
| |
4 |
4 |
received feedback from early adopters. Many thanks for the helpful and |
| |
5 |
5 |
the constructive comments! This feedback triggered an internal |
| |
6 |
6 |
discussion and led to revising some earlier design decisions and |
| |
7 |
|
naming conventions used in the APIs to achieve better comprehension |
| |
8 |
|
and orthogonality. |
| |
|
7 |
naming conventions used in the APIs to achieve better |
| |
|
8 |
comprehensibility and orthogonality. |
| |
9 |
9 |
|
| |
10 |
|
The new release differs in about 250 commits since the release of |
| |
11 |
|
2.0b3. The implementation is very stable and is used since |
| |
12 |
|
more than two years in production of our large scale, multi threaded |
| |
13 |
|
web environment inside NaviServer. Most of the changes happened |
| |
14 |
|
in NX and therefore on the NSF scripting level, without the need |
| |
15 |
|
to modify the NSF C layer. The implementation of XOTcl 2 |
| |
16 |
|
has changed very little. The Next Scripting Framework was tested |
| |
17 |
|
with Tcl 8.5.14 and Tcl 8.6.0. |
| |
|
10 |
Since the release of 2.0b3, there were more than 250 commits to our |
| |
|
11 |
code repository. The implementation is very stable and has been used for |
| |
|
12 |
more than two years in production of our large-scale, multi-threaded |
| |
|
13 |
web environment inside NaviServer. Most of the changes happened in NX |
| |
|
14 |
and, therefore, on the NSF scripting level, without the need to modify |
| |
|
15 |
the NSF C layer. The implementation of XOTcl 2 has changed very |
| |
|
16 |
little. The Next Scripting Framework was tested with Tcl 8.5.14 and |
| |
|
17 |
Tcl 8.6.0. |
| |
18 |
18 |
|
| |
19 |
19 |
This beta-release is supposed to be the last release before |
| |
20 |
20 |
the final 2.0 is out, which should be soon. |
| |
21 |
21 |
|
| |
22 |
22 |
Below are the most notable differences in 2.0b5 as compared to |
| |
23 |
23 |
2.0b3: |
| |
24 |
24 |
|
| |
25 |
25 |
a) NX 2.0b3 used the following conventions to define methods for |
| |
26 |
26 |
instances, object-specific methods and class-object specific |
| |
27 |
27 |
methods: |
| |
28 |
28 |
|
| |
29 |
29 |
/cls/ method foo {args} {...} |
| |
30 |
30 |
/obj/ method bar {args} {...} |
| |
31 |
31 |
/cls/ class method baz {args} {...} |
| |
32 |
32 |
|
| |
33 |
33 |
Introspection was possible via (in the same order): |
| |
34 |
34 |
|
| |
35 |
35 |
/cls/ info methods |
| |
36 |
36 |
/obj/ info methods |
| |
37 |
37 |
/cls/ class info methods |
|
| |
43 |
43 |
the most general class nx::Object, the same introspection operation |
| |
44 |
44 |
(e.g., "info methods") should return e.g. object-specific methods |
| |
45 |
45 |
for both class objects and ordinary, non-class objects. |
| |
46 |
46 |
|
| |
47 |
47 |
Therefore, we adopted the following more orthogonal |
| |
48 |
48 |
conventions to define methods for instances and |
| |
49 |
49 |
for object-specific methods |
| |
50 |
50 |
|
| |
51 |
51 |
/cls/ method foo {args} {...} |
| |
52 |
52 |
/obj/ object method bar {args} {...} |
| |
53 |
53 |
|
| |
54 |
54 |
Introspection: |
| |
55 |
55 |
|
| |
56 |
56 |
/cls/ info methods |
| |
57 |
57 |
/obj/ info object methods |
| |
58 |
58 |
|
| |
59 |
59 |
Note that we can now use the same mechanism to define |
| |
60 |
60 |
or query object-specific methods on objects and classes. |
| |
61 |
61 |
The same applies for aliases, forwards, mixins, and filters. |
| |
62 |
62 |
|
| |
63 |
|
The new convention imposes a little typing burden on the |
| |
64 |
|
developer, but reduces the effort of a reader of a |
| |
65 |
|
program for understanding what exactly |
| |
66 |
|
$x method FOO {args} {...} |
| |
67 |
|
means. |
| |
|
63 |
The new convention imposes a little typing burden on the developer, |
| |
|
64 |
but reduces the reading effort when trying to understand what |
| |
|
65 |
exactly $x method FOO {args} {...} means. |
| |
68 |
66 |
|
| |
69 |
67 |
For convenience, we provide two packages "nx::plain-object-method" |
| |
70 |
68 |
and "nx::class-method" to switch to the old conventions. A verbose |
| |
71 |
69 |
tracing mode can report usages to ease migration. |
| |
72 |
70 |
|
| |
73 |
71 |
|
| |
74 |
72 |
b) Parametrization: |
| |
75 |
73 |
|
| |
76 |
74 |
NX 2.0b3 followed the XOTcl conventions of registering by default |
| |
77 |
75 |
same-named getter/setter methods for configuration parameters used |
| |
78 |
76 |
in object creation. These getter/setter methods bloat the method |
| |
79 |
77 |
interface and risk shadowing inherited methods, leading to |
| |
80 |
78 |
unexpected behaviors for beginners. |
| |
81 |
79 |
|
| |
82 |
80 |
NX 2.0b5 adopts a Tk/itcl/... idiom by offering a cget/configure |
| |
83 |
81 |
interface to objects as generic getters/setters. To obtain |
| |
84 |
82 |
parameter-specific getters/setters (i.e., the old behavior), the |
| |
85 |
83 |
flag "-accessor public|protected|private" can be set when defining |
| |
86 |
84 |
properties and variables. |
| |
87 |
85 |
|
| |
88 |
86 |
c) Further clean-ups of the introspection interface ("info"). |
| |
89 |
87 |
|
| |
90 |
88 |
In order to streamline the interface further, we followed the idea |
| |
91 |
89 |
to use "... info /plural word/" to obtain a set of handles, and |
| |
92 |
|
then to make a separate call to obtain the details. Therefore, we |
| |
|
90 |
then to make a separate call to retrieve the details. Therefore, we |
| |
93 |
91 |
now provide ... |
| |
94 |
92 |
|
| |
95 |
93 |
/cls/ info methods |
| |
96 |
94 |
/obj/ info object methods |
| |
97 |
95 |
|
| |
98 |
96 |
/cls/ info variables |
| |
99 |
97 |
/obj/ info object variables |
| |
100 |
98 |
|
| |
101 |
99 |
/cls/ info slots |
| |
102 |
100 |
/obj/ info object slots |
| |
103 |
101 |
|
| |
104 |
102 |
/cls/ info method parameters /methodName/ |
| |
105 |
103 |
/obj/ info object method parameters /methodName/ |
| |
106 |
104 |
|
| |
107 |
105 |
/cls/ info configure parameters |
| |
108 |
106 |
/obj/ info lookup configure parameters |
| |
109 |
107 |
|
| |
110 |
108 |
... to return a list of handles. The result list can be filtered in |
| |
111 |
109 |
each case by specifying a match pattern. Each result handle can |
| |
112 |
110 |
then be used in a separate call to obtain details: |
| |
113 |
111 |
|
| |
114 |
112 |
/obj/ info method definition /methodHandle/ |
| |
115 |
113 |
/obj/ info variable definition /varHandle/ |
| |
116 |
114 |
/obj/ info parameter name /paramHandle/ |
| |
117 |
115 |
|
| |
118 |
116 |
These are just a few examples. |
| |
119 |
117 |
|
| |
120 |
118 |
In NX 2.0b3, we had e.g. "... info parameter definitions ..." |
| |
121 |
119 |
leaving a beginner in the dark about the parameters actually |
| |
122 |
120 |
meant. Also, the introspection interface made mixed use of plural |
| |
123 |
121 |
and singular wordings for different purposes (e.g., retrieving |
| |
124 |
122 |
collections and/or detailed information on one item). |
| |
125 |
123 |
|
| |
126 |
124 |
Below is a more detailed summary of the changes. |
| |
127 |
125 |
|
| |
128 |
|
The Next Scripting Framework 2.0b5 (containing NX and XOTcl 2.0) |
| |
129 |
|
can be obtained from http://next-scripting.org/ |
| |
|
126 |
The Next Scripting Framework 2.0b5 (containing NX and XOTcl 2.0b5) can |
| |
|
127 |
be obtained from http://next-scripting.org/ |
| |
130 |
128 |
|
| |
131 |
129 |
Best regards |
| |
132 |
130 |
- Gustaf Neumann |
| |
133 |
131 |
- Stefan Sobernig |
| |
134 |
132 |
|
| |
135 |
133 |
=============================================== |
| |
136 |
134 |
|
| |
137 |
135 |
Announcing NSF 2.0b5 |
| |
138 |
136 |
************************* |
| |
139 |
137 |
|
| |
140 |
138 |
Major changes relative to NSF 2.0b3 are (in addition of |
| |
141 |
139 |
the items (a), (b), and (c) above) are: |
| |
142 |
140 |
|
| |
143 |
141 |
* Additional Features: |
| |
144 |
142 |
|
| |
145 |
143 |
- serializer: |
| |
146 |
144 |
* added flag -objmap to Serializer method deepSerialize |
| |
147 |
145 |
to make serializer to provide mapping only for |
| |
148 |
146 |
object names. This makes the serializer |
| |
149 |
147 |
usable for object/class copying (-map is too coarse) |