File: INCOMPATIBLE

package info (click to toggle)
itcl3.1 3.1.0-6
  • links: PTS
  • area: main
  • in suites: woody
  • size: 9,604 kB
  • ctags: 1,045
  • sloc: tcl: 33,268; ansic: 14,071; sh: 3,918; makefile: 762; awk: 273; perl: 265
file content (102 lines) | stat: -rw-r--r-- 5,180 bytes parent folder | download | duplicates (26)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102

As much as possible, I've tried to make itcl3.0 backward-compatible
with earlier releases.  The class definition syntax has not changed
at all from itcl2.2, and the old itcl1.x syntax is still supported.
But you'll notice changes related to namespaces.  John Ousterhout
adopted a slightly different namespace model for Tcl8.  The syntax
of the "namespace" command is different, as well as the semantics
for command/variable lookups and imports.  Also, John Ousterhout
failed to adopt ensembles into the Tcl core, so itcl can't add
functions like "info objects" and "info classes" into the usual "info"
command.  These functions have been moved to a new "itcl::find" command.

The [incr Widgets] package has changed quite a bit.  There are many
new widgets, and some of the existing widgets were streamlined--some
of the widget options were removed to improve performance.  For details,
see the "CHANGES" file in the iwidgets3.0.0 directory.  Because there
are a lot of changes, this distribution contains the iwidgets2.2.0
package, which is backward-compatible with the existing [incr Widgets].

Following is a quick summary of changes, to serve as a porting guide.


----------------------------------|-------------------------------------
 You have code like this...       | change to this...
----------------------------------|-------------------------------------
 namespace foo {...}              | namespace eval foo {...}
                                  |
 delete namespace foo             | namespace delete foo
                                  |
 info which -namespace $name      | if {![string match ::* $name]} {
                                  |     set name [namespace current]::$name
                                  | }
                                  |
 info context                     | namespace current
                                  |
 info objects ...                 | itcl::find objects ...
                                  |
 info classes ...                 | itcl::find classes ...
                                  |
 In itcl2.2, commands/classes     | In Tcl8.0, all commands/classes that
 could be found in any namespace  | are not in the global namespace must
 in a hierarchy.  So within a     | be qualified.  For example, the
 namespace like "iwidgets" you    | "iwidgets" namespace has a bunch of
 could use simple names like:     | classes within it.  You must always
                                  | refer to these classes with qualified
                                  | names, like this:
                                  |
 Labeledwidget::alignlabels ...   | iwidgets::Labeledwidget::alignlabels ...
 Pane #auto                       | iwidgets::Pane #auto
                                  |
                                  |
 In itcl2.2, the "global"         | In Tcl8.0, the "variable" command is
 command was used to access       | used to access variables in a namespace:
 variables in a namespace:        |
                                  |
   namespace foo {                | namespace eval foo {
       variable x 0               |     variable x 0
       proc example {} {          |     proc example {} {
           global x               |         variable x
           return $x              |         return $x
       }                          |     }
   }                              | }
                                  |
                                  |
 public itk_component add...      | itk_component add ...
 protected itk_component add...   | itk_component add -protected ...
 private itk_component add...     | itk_component add -private ...
                                  |
                                  |

 OTHER DIFFERENCES
------------------------------------------------------------------------
- You can now use instance variables (along with the usual common
  variables) with the "scope" command.  Thus, you're no longer forced
  to use the trick with a common array like:  [scope modes($this)]

- All widget/mega-widget access commands (e.g., ".foo.bar") are
  installed in the global namespace.  Therefore, they can be accessed
  from any namespace context.

- The [incr Widgets] package used to be loaded by default.  You must
  now use the "package require" command to load it explicitly:

    package require Iwidgets              <-- loads the lastest (iwidgets3.0.0)
    package require -exact Iwidgets 2.2   <-- loads the older release

- Command/variable names are now reported with fully-qualified names
  in "info" inquiries and in error messages.

- No public/protected/private declarations outside of class definitions

- The "scope" command used to be more or less the same as the "code"
  command.  In itcl3.x, "scope" is only for variables, and if a variable
  is not recognized, you'll get an error.

- The "code" command used to return a value like "@scope ...".  It now
  returns "namespace inscope ...", to be compatible with Tcl8.

- The prototypes for Itcl_RegisterC and Itcl_FindC have changed.  You
  can now include ClientData when you register C functions.  Also, there
  is a new Itcl_RegisterObjC function for (objc,objv)-style command
  handlers.