Index: TODO
===================================================================
diff -u -rd15bb1fa36c4f2cf118b2ce915928294e762d336 -rad4acf8e7b3c2279b4711aa9cfd5aed6d86e2b98
--- TODO	(.../TODO)	(revision d15bb1fa36c4f2cf118b2ce915928294e762d336)
+++ TODO	(.../TODO)	(revision ad4acf8e7b3c2279b4711aa9cfd5aed6d86e2b98)
@@ -3245,7 +3245,12 @@
 - updated next-tutorial to the current naming conventions
 - added tests for using submethod handles
 
+- changed Stack example in tutorial from constructor to :variable
+- allow just valid specs for :attribute and :variable methods
+- improved error message for invalid parameter specs (with leading colons)
+- extended regression test
 
+
 TODO:
 
  - strange refcounting bug in 8.6b2 bug-is-86.tcl
Index: doc/next-tutorial.html
===================================================================
diff -u -re92bab3b262d521ac909fd8956352473909197fb -rad4acf8e7b3c2279b4711aa9cfd5aed6d86e2b98
--- doc/next-tutorial.html	(.../next-tutorial.html)	(revision e92bab3b262d521ac909fd8956352473909197fb)
+++ doc/next-tutorial.html	(.../next-tutorial.html)	(revision ad4acf8e7b3c2279b4711aa9cfd5aed6d86e2b98)
@@ -818,8 +818,8 @@
 <h3 id="_define_a_class_stack">2.1. Define a Class "Stack"</h3>
 <div class="paragraph"><p>In our first example, we define a class named <tt>Stack</tt> with the methods
 <tt>push</tt> and <tt>pop</tt>. When an instance of the stack is created (e.g. a
-concrete stack <tt>s1</tt>) the stack will be initialized via the constructor
-<tt>init</tt>.</p></div>
+concrete stack <tt>s1</tt>) the stack will contain an instance variable named
+<tt>things</tt> initialized with the an empty list.</p></div>
 <div class="paragraph" id="xmp-class-stack"><div class="title">Listing 2: Class Stack</div><p></p></div>
 <div class="listingblock">
 <div class="content"><style type='text/css'>
@@ -851,17 +851,13 @@
  17
  18
  19
- 20
- 21
 </pre></td><td class='nx-body'><pre class='nx'><span class='nx-keyword'>nx::Class</span> <span class='nx-keyword'>create</span> Stack {
 
    <span class='nx-comment'>#
 </span>   <span class='nx-comment'># Stack of Things
 </span>   <span class='nx-comment'>#
 </span>
-   :<span class='nx-keyword'>method</span> <span class='nx-keyword'>init</span> {} {
-     <span class='nx-keyword'>set</span> :things <span class='nx-string'>""</span>
-   }
+   :<span class='nx-keyword'>variable</span> things {}
 
    :<span class='nx-keyword'>public</span> <span class='nx-keyword'>method</span> push {thing} {
       <span class='nx-keyword'>set</span> :things [<span class='nx-keyword'>linsert</span> <span class='nx-variable'>${</span><span class='nx-variable'>:things}</span> 0 <span class='nx-variable'>$thing</span>]
@@ -880,28 +876,29 @@
 definitions. Methods of the class are defined via <tt>:method</tt> followed
 by the name of the method, an argument list and the body of the
 method, consisting of Tcl and NX statements.</p></div>
-<div class="paragraph"><p>The first method is the constructor <tt>init</tt>, where the Tcl command <tt>set</tt>
-is used to set the instance variable <tt>things</tt> to empty. The leading
-colon of the variable denotes that the variable is an instance variable
-and belongs to instances of this class. If multiple stack instances
-are created, every one of these will have a different variable. The
-instance variable <tt>things</tt> is used in our example as a list for the
-internal representation of the stack. We define in a next step the
-methods to access and modify this list structure. A user of the stack
-using the the provided methods does not have to have any knowledge
-about the name or the structure of the internal representation.</p></div>
+<div class="paragraph"><p>When an instance of <tt>Stack</tt> is created, it will contain an instance
+variable named <tt>things</tt>. If several <tt>Stack</tt> instances are created,
+each of the instances will have their own (same-named but different)
+instance variable. The instance variable <tt>things</tt> is used in our
+example as a list for the internal representation of the stack. We
+define in a next step the methods to access and modify this list
+structure. A user of the stack using the the provided methods does not
+have to have any knowledge about the name or the structure of the
+internal representation (the instance variable <tt>things</tt>).</p></div>
 <div class="paragraph"><p>The method <tt>push</tt> receives an argument <tt>thing</tt> which should be placed
 on the stack. Note that we do not have to specify the type of the
 element on the stack, so we can push strings as well as numbers or
-other kind of things. When an element is pushed, we add this element
+other kind of things.</p></div>
+<div class="paragraph"><p>When an element is pushed, we add this element
 as the first element to the list <tt>things</tt>. We insert the element using
 the Tcl command <tt>linsert</tt> which receives the list as first element,
 the position where the element should be added as second and the new
 element as third argument. To access the value of the instance
-variable we use the dollar operator followed by the name. Since the
+variable we use the dollar operator followed by the name. Instance
+varibables are preceded with a colon <tt>:</tt>. Since the
 name contains a colon (to denote that the variable is an instance
-variable), Tcl requires us to put braces around the name. Since
-<tt>linsert</tt> and its arguments are placed between square brackets, the
+variable), Tcl requires us to put braces around the name. The command
+<tt>linsert</tt> and its arguments are placed between square brackets, therefore
 function is called and returns the new list. The result is assigned
 again to the instance variable <tt>things</tt> which is updated this way.
 Finally the method <tt>push</tt> returns the pushed thing using the <tt>return</tt>
@@ -1045,7 +1042,7 @@
  15
 </pre></td><td class='nx-body'><pre class='nx'><span class='nx-keyword'>nx::Object</span> <span class='nx-keyword'>create</span> stack {
 
-   <span class='nx-keyword'>set</span> :things <span class='nx-string'>""</span>
+   :<span class='nx-keyword'>variable</span> things {}
 
    :<span class='nx-keyword'>public</span> <span class='nx-keyword'>method</span> push {thing} {
       <span class='nx-keyword'>set</span> :things [<span class='nx-keyword'>linsert</span> <span class='nx-variable'>${</span><span class='nx-variable'>:things}</span> 0 <span class='nx-variable'>$thing</span>]
@@ -1070,10 +1067,8 @@
 </li>
 <li>
 <p>
-Secondly, we do not need a constructor (which is called at the time
-   an instance of a class is created), since we do not create a class
-   here. Instead, we can set the instance variable <tt>things</tt> directly
-   for this object (the object <tt>stack</tt>).
+As in the example above, we use <tt>:variable</tt> to define the
+  instance variable <tt>things</tt>  for this object (the object <tt>stack</tt>).
 </p>
 </li>
 </ul></div>
@@ -1156,22 +1151,18 @@
  22
  23
  24
- 25
- 26
 </pre></td><td class='nx-body'><pre class='nx'><span class='nx-keyword'>nx::Class</span> <span class='nx-keyword'>create</span> Safety {
 
   <span class='nx-comment'>#
 </span>  <span class='nx-comment'># Implement stack safety by defining an additional
 </span>  <span class='nx-comment'># instance variable named "count" that keeps track of
 </span>  <span class='nx-comment'># the number of stacked elements. The methods of
 </span>  <span class='nx-comment'># this class have the same names and argument lists
-</span>  <span class='nx-comment'># and will shadow the methods of class Stack.
+</span>  <span class='nx-comment'># as the methods of Stack; these methods "shadow"
+</span>  <span class='nx-comment'># the methods of class Stack.
 </span>  <span class='nx-comment'>#
 </span>
-  :<span class='nx-keyword'>method</span> <span class='nx-keyword'>init</span> {} { <span class='nx-comment'># Constructor
-</span>    <span class='nx-keyword'>set</span> :count 0
-    <span class='nx-keyword'>next</span>
-  }
+  :<span class='nx-keyword'>variable</span> count 0
 
   :<span class='nx-keyword'>public</span> <span class='nx-keyword'>method</span> push {thing} {
     <span class='nx-keyword'>incr</span> :count
@@ -1470,17 +1461,13 @@
  22
  23
  24
- 25
- 26
 </pre></td><td class='nx-body'><pre class='nx'><span class='nx-keyword'>nx::Class</span> <span class='nx-keyword'>create</span> Stack2 {
 
     :<span class='nx-keyword'>public</span> <span class='nx-keyword'>class</span> <span class='nx-keyword'>method</span> available_stacks {} {
       <span class='nx-keyword'>return</span> [<span class='nx-keyword'>llength</span> [:<span class='nx-keyword'>info</span> instances]]
    }
 
-   :<span class='nx-keyword'>method</span> <span class='nx-keyword'>init</span> {} {
-     <span class='nx-keyword'>set</span> :things <span class='nx-string'>""</span>
-   }
+   :<span class='nx-keyword'>variable</span> things {}
 
    :<span class='nx-keyword'>public</span> <span class='nx-keyword'>method</span> push {thing} {
       <span class='nx-keyword'>set</span> :things [<span class='nx-keyword'>linsert</span> <span class='nx-variable'>${</span><span class='nx-variable'>:things}</span> 0 <span class='nx-variable'>$thing</span>]
@@ -2738,7 +2725,7 @@
 <div id="footer">
 <div id="footer-text">
 Version 2.1<br />
-Last updated 2011-08-08 16:08:10 CEST
+Last updated 2011-08-08 17:35:56 CEST
 </div>
 </div>
 </body>
Index: doc/next-tutorial.txt
===================================================================
diff -u -re92bab3b262d521ac909fd8956352473909197fb -rad4acf8e7b3c2279b4711aa9cfd5aed6d86e2b98
--- doc/next-tutorial.txt	(.../next-tutorial.txt)	(revision e92bab3b262d521ac909fd8956352473909197fb)
+++ doc/next-tutorial.txt	(.../next-tutorial.txt)	(revision ad4acf8e7b3c2279b4711aa9cfd5aed6d86e2b98)
@@ -100,8 +100,8 @@
 
 In our first example, we define a class named +Stack+ with the methods
 +push+ and +pop+. When an instance of the stack is created (e.g. a
-concrete stack +s1+) the stack will be initialized via the constructor
-+init+.
+concrete stack +s1+) the stack will contain an instance variable named
++things+ initialized with the an empty list.
 
 [[xmp-class-stack]]
 .Listing {counter:figure-number}: Class Stack
@@ -113,11 +113,9 @@
    #
    # Stack of Things
    #
+   
+   :variable things {}
 
-   :method init {} {
-     set :things ""
-   } 
-
    :public method push {thing} {
       set :things [linsert ${:things} 0 $thing] 
       return $thing
@@ -138,29 +136,31 @@
 by the name of the method, an argument list and the body of the
 method, consisting of Tcl and NX statements.
 
-The first method is the constructor +init+, where the Tcl command +set+
-is used to set the instance variable +things+ to empty. The leading
-colon of the variable denotes that the variable is an instance variable
-and belongs to instances of this class. If multiple stack instances
-are created, every one of these will have a different variable. The
-instance variable +things+ is used in our example as a list for the
-internal representation of the stack. We define in a next step the
-methods to access and modify this list structure. A user of the stack
-using the the provided methods does not have to have any knowledge
-about the name or the structure of the internal representation.
+When an instance of +Stack+ is created, it will contain an instance
+variable named +things+. If several +Stack+ instances are created,
+each of the instances will have their own (same-named but different)
+instance variable. The instance variable +things+ is used in our
+example as a list for the internal representation of the stack. We
+define in a next step the methods to access and modify this list
+structure. A user of the stack using the the provided methods does not
+have to have any knowledge about the name or the structure of the
+internal representation (the instance variable +things+).
 
 The method +push+ receives an argument +thing+ which should be placed
 on the stack. Note that we do not have to specify the type of the
 element on the stack, so we can push strings as well as numbers or
-other kind of things. When an element is pushed, we add this element
+other kind of things. 
+
+When an element is pushed, we add this element
 as the first element to the list +things+. We insert the element using
 the Tcl command +linsert+ which receives the list as first element,
 the position where the element should be added as second and the new
 element as third argument. To access the value of the instance
-variable we use the dollar operator followed by the name. Since the
+variable we use the dollar operator followed by the name. Instance
+varibables are preceded with a colon +:+. Since the
 name contains a colon (to denote that the variable is an instance
-variable), Tcl requires us to put braces around the name. Since
-+linsert+ and its arguments are placed between square brackets, the
+variable), Tcl requires us to put braces around the name. The command
++linsert+ and its arguments are placed between square brackets, therefore
 function is called and returns the new list. The result is assigned
 again to the instance variable +things+ which is updated this way.
 Finally the method +push+ returns the pushed thing using the +return+
@@ -265,7 +265,7 @@
 --------------------------------------------------
 nx::Object create stack {
 
-   set :things ""
+   :variable things {}
 
    :public method push {thing} {
       set :things [linsert ${:things} 0 $thing] 
@@ -287,10 +287,8 @@
 - First, we use +nx::Object+ instead of +nx::Class+ to denote
   that we want to create a generic object, not a class.
 
-- Secondly, we do not need a constructor (which is called at the time
-   an instance of a class is created), since we do not create a class
-   here. Instead, we can set the instance variable +things+ directly
-   for this object (the object +stack+).
+- As in the example above, we use +:variable+ to define the
+  instance variable +things+  for this object (the object +stack+).
 
 The definition for the methods +push+ and +pop+ are the same as
 before, but this times they are object specify. All methods defined on
@@ -350,13 +348,11 @@
   # instance variable named "count" that keeps track of
   # the number of stacked elements. The methods of 
   # this class have the same names and argument lists
-  # and will shadow the methods of class Stack.
+  # as the methods of Stack; these methods "shadow"
+  # the methods of class Stack.
   #
         
-  :method init {} { # Constructor
-    set :count 0
-    next
-  } 
+  :variable count 0
 
   :public method push {thing} {
     incr :count
@@ -574,9 +570,7 @@
       return [llength [:info instances]]
    }
 
-   :method init {} {
-     set :things ""
-   } 
+   :variable things {}
 
    :public method push {thing} {
       set :things [linsert ${:things} 0 $thing] 
Index: generic/nsf.c
===================================================================
diff -u -r7b09de6f9ec1cc5caf39751fa4f23c62365e8dfe -rad4acf8e7b3c2279b4711aa9cfd5aed6d86e2b98
--- generic/nsf.c	(.../nsf.c)	(revision 7b09de6f9ec1cc5caf39751fa4f23c62365e8dfe)
+++ generic/nsf.c	(.../nsf.c)	(revision ad4acf8e7b3c2279b4711aa9cfd5aed6d86e2b98)
@@ -10089,7 +10089,9 @@
   *outObjPtr = objPtr;
   /*fprintf(stderr, "convert to parameter '%s' t '%s'\n", value, pPtr->type);*/
   if (*value == ':' ||  (*value == '-' && *(value + 1) == ':')) {
-    return NsfObjErrType(interp, NULL, objPtr, pPtr->type, (Nsf_Param *)pPtr);
+    return NsfPrintError(interp, "leading colon in '%s' not allowed as in parameter specification '%s'",
+			 ObjStr(objPtr), pPtr->name);
+    //NsfObjErrType(interp, NULL, objPtr, pPtr->type, (Nsf_Param *)pPtr);
   }
 
   *clientData = (char *)ObjStr(objPtr);
Index: library/nx/nx.tcl
===================================================================
diff -u -r40c99702db40bd86761bfea1f1209cc761e61e62 -rad4acf8e7b3c2279b4711aa9cfd5aed6d86e2b98
--- library/nx/nx.tcl	(.../nx.tcl)	(revision 40c99702db40bd86761bfea1f1209cc761e61e62)
+++ library/nx/nx.tcl	(.../nx.tcl)	(revision ad4acf8e7b3c2279b4711aa9cfd5aed6d86e2b98)
@@ -1629,7 +1629,7 @@
      {-incremental:switch}
      {-initblock ""} 
      {-nocomplain:switch}
-     spec 
+     spec:parameter
      value:optional
    } {
     #
@@ -1696,7 +1696,7 @@
     {-class ""} 
     -incremental:switch 
     -nocomplain:switch 
-    spec 
+     spec:parameter
     {initblock ""}
   } {
     set r [[self] ::nsf::classes::nx::Object::variable \
@@ -1715,7 +1715,7 @@
      {-configparameter:switch}
      -incremental:switch
      {-initblock ""} 
-     spec 
+     spec:parameter
      default:optional
    } {
     if {$incremental} {
@@ -1737,7 +1737,7 @@
   nx::Class method attribute {
     {-class ""}
     -incremental:switch 
-    spec  
+    spec:parameter
     {initblock ""}
   } {
     set r [[self] ::nsf::classes::nx::Class::variable \
Index: tests/parameters.test
===================================================================
diff -u -re3487a745ff8d03bff82959c8fb0852e9ae23b36 -rad4acf8e7b3c2279b4711aa9cfd5aed6d86e2b98
--- tests/parameters.test	(.../parameters.test)	(revision e3487a745ff8d03bff82959c8fb0852e9ae23b36)
+++ tests/parameters.test	(.../parameters.test)	(revision ad4acf8e7b3c2279b4711aa9cfd5aed6d86e2b98)
@@ -1981,6 +1981,21 @@
 }
 
 #
+# test classes with single variable definitions, and illegal names
+#
+nx::Test case single-variable {
+  ? {Class create C {
+    :variable v 1
+    :create c1
+  }} ::C
+  ? {c1 info vars} v
+  
+  ? {Class create D {
+    :variable :v 1
+  }} {leading colon in ':v' not allowed as in parameter specification 'spec'}
+}
+
+#
 # test deletion of class level attribute and variable
 #
 nx::Test case delete-class-level-variable-and-attribute {