URL
https://opencores.org/ocsvn/or1k/or1k/trunk
Subversion Repositories or1k
[/] [or1k/] [trunk/] [insight/] [itcl/] [INCOMPATIBLE] - Rev 1781
Go to most recent revision | Compare with Previous | Blame | View Log
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.
Go to most recent revision | Compare with Previous | Blame | View Log