OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [itcl/] [INCOMPATIBLE] - Blame information for rev 578

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
 
2
As much as possible, I've tried to make itcl3.0 backward-compatible
3
with earlier releases.  The class definition syntax has not changed
4
at all from itcl2.2, and the old itcl1.x syntax is still supported.
5
But you'll notice changes related to namespaces.  John Ousterhout
6
adopted a slightly different namespace model for Tcl8.  The syntax
7
of the "namespace" command is different, as well as the semantics
8
for command/variable lookups and imports.  Also, John Ousterhout
9
failed to adopt ensembles into the Tcl core, so itcl can't add
10
functions like "info objects" and "info classes" into the usual "info"
11
command.  These functions have been moved to a new "itcl::find" command.
12
 
13
The [incr Widgets] package has changed quite a bit.  There are many
14
new widgets, and some of the existing widgets were streamlined--some
15
of the widget options were removed to improve performance.  For details,
16
see the "CHANGES" file in the iwidgets3.0.0 directory.  Because there
17
are a lot of changes, this distribution contains the iwidgets2.2.0
18
package, which is backward-compatible with the existing [incr Widgets].
19
 
20
Following is a quick summary of changes, to serve as a porting guide.
21
 
22
 
23
----------------------------------|-------------------------------------
24
 You have code like this...       | change to this...
25
----------------------------------|-------------------------------------
26
 namespace foo {...}              | namespace eval foo {...}
27
                                  |
28
 delete namespace foo             | namespace delete foo
29
                                  |
30
 info which -namespace $name      | if {![string match ::* $name]} {
31
                                  |     set name [namespace current]::$name
32
                                  | }
33
                                  |
34
 info context                     | namespace current
35
                                  |
36
 info objects ...                 | itcl::find objects ...
37
                                  |
38
 info classes ...                 | itcl::find classes ...
39
                                  |
40
 In itcl2.2, commands/classes     | In Tcl8.0, all commands/classes that
41
 could be found in any namespace  | are not in the global namespace must
42
 in a hierarchy.  So within a     | be qualified.  For example, the
43
 namespace like "iwidgets" you    | "iwidgets" namespace has a bunch of
44
 could use simple names like:     | classes within it.  You must always
45
                                  | refer to these classes with qualified
46
                                  | names, like this:
47
                                  |
48
 Labeledwidget::alignlabels ...   | iwidgets::Labeledwidget::alignlabels ...
49
 Pane #auto                       | iwidgets::Pane #auto
50
                                  |
51
                                  |
52
 In itcl2.2, the "global"         | In Tcl8.0, the "variable" command is
53
 command was used to access       | used to access variables in a namespace:
54
 variables in a namespace:        |
55
                                  |
56
   namespace foo {                | namespace eval foo {
57
       variable x 0               |     variable x 0
58
       proc example {} {          |     proc example {} {
59
           global x               |         variable x
60
           return $x              |         return $x
61
       }                          |     }
62
   }                              | }
63
                                  |
64
                                  |
65
 public itk_component add...      | itk_component add ...
66
 protected itk_component add...   | itk_component add -protected ...
67
 private itk_component add...     | itk_component add -private ...
68
                                  |
69
                                  |
70
 
71
 OTHER DIFFERENCES
72
------------------------------------------------------------------------
73
- You can now use instance variables (along with the usual common
74
  variables) with the "scope" command.  Thus, you're no longer forced
75
  to use the trick with a common array like:  [scope modes($this)]
76
 
77
- All widget/mega-widget access commands (e.g., ".foo.bar") are
78
  installed in the global namespace.  Therefore, they can be accessed
79
  from any namespace context.
80
 
81
- The [incr Widgets] package used to be loaded by default.  You must
82
  now use the "package require" command to load it explicitly:
83
 
84
    package require Iwidgets              <-- loads the lastest (iwidgets3.0.0)
85
    package require -exact Iwidgets 2.2   <-- loads the older release
86
 
87
- Command/variable names are now reported with fully-qualified names
88
  in "info" inquiries and in error messages.
89
 
90
- No public/protected/private declarations outside of class definitions
91
 
92
- The "scope" command used to be more or less the same as the "code"
93
  command.  In itcl3.x, "scope" is only for variables, and if a variable
94
  is not recognized, you'll get an error.
95
 
96
- The "code" command used to return a value like "@scope ...".  It now
97
  returns "namespace inscope ...", to be compatible with Tcl8.
98
 
99
- The prototypes for Itcl_RegisterC and Itcl_FindC have changed.  You
100
  can now include ClientData when you register C functions.  Also, there
101
  is a new Itcl_RegisterObjC function for (objc,objv)-style command
102
  handlers.

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.