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

Subversion Repositories or1k

[/] [or1k/] [tags/] [start/] [insight/] [itcl/] [INCOMPATIBLE] - Diff between revs 579 and 1765

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 579 Rev 1765
As much as possible, I've tried to make itcl3.0 backward-compatible
As much as possible, I've tried to make itcl3.0 backward-compatible
with earlier releases.  The class definition syntax has not changed
with earlier releases.  The class definition syntax has not changed
at all from itcl2.2, and the old itcl1.x syntax is still supported.
at all from itcl2.2, and the old itcl1.x syntax is still supported.
But you'll notice changes related to namespaces.  John Ousterhout
But you'll notice changes related to namespaces.  John Ousterhout
adopted a slightly different namespace model for Tcl8.  The syntax
adopted a slightly different namespace model for Tcl8.  The syntax
of the "namespace" command is different, as well as the semantics
of the "namespace" command is different, as well as the semantics
for command/variable lookups and imports.  Also, John Ousterhout
for command/variable lookups and imports.  Also, John Ousterhout
failed to adopt ensembles into the Tcl core, so itcl can't add
failed to adopt ensembles into the Tcl core, so itcl can't add
functions like "info objects" and "info classes" into the usual "info"
functions like "info objects" and "info classes" into the usual "info"
command.  These functions have been moved to a new "itcl::find" command.
command.  These functions have been moved to a new "itcl::find" command.
The [incr Widgets] package has changed quite a bit.  There are many
The [incr Widgets] package has changed quite a bit.  There are many
new widgets, and some of the existing widgets were streamlined--some
new widgets, and some of the existing widgets were streamlined--some
of the widget options were removed to improve performance.  For details,
of the widget options were removed to improve performance.  For details,
see the "CHANGES" file in the iwidgets3.0.0 directory.  Because there
see the "CHANGES" file in the iwidgets3.0.0 directory.  Because there
are a lot of changes, this distribution contains the iwidgets2.2.0
are a lot of changes, this distribution contains the iwidgets2.2.0
package, which is backward-compatible with the existing [incr Widgets].
package, which is backward-compatible with the existing [incr Widgets].
Following is a quick summary of changes, to serve as a porting guide.
Following is a quick summary of changes, to serve as a porting guide.
----------------------------------|-------------------------------------
----------------------------------|-------------------------------------
 You have code like this...       | change to this...
 You have code like this...       | change to this...
----------------------------------|-------------------------------------
----------------------------------|-------------------------------------
 namespace foo {...}              | namespace eval foo {...}
 namespace foo {...}              | namespace eval foo {...}
                                  |
                                  |
 delete namespace foo             | namespace delete foo
 delete namespace foo             | namespace delete foo
                                  |
                                  |
 info which -namespace $name      | if {![string match ::* $name]} {
 info which -namespace $name      | if {![string match ::* $name]} {
                                  |     set name [namespace current]::$name
                                  |     set name [namespace current]::$name
                                  | }
                                  | }
                                  |
                                  |
 info context                     | namespace current
 info context                     | namespace current
                                  |
                                  |
 info objects ...                 | itcl::find objects ...
 info objects ...                 | itcl::find objects ...
                                  |
                                  |
 info classes ...                 | itcl::find classes ...
 info classes ...                 | itcl::find classes ...
                                  |
                                  |
 In itcl2.2, commands/classes     | In Tcl8.0, all commands/classes that
 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
 could be found in any namespace  | are not in the global namespace must
 in a hierarchy.  So within a     | be qualified.  For example, the
 in a hierarchy.  So within a     | be qualified.  For example, the
 namespace like "iwidgets" you    | "iwidgets" namespace has a bunch of
 namespace like "iwidgets" you    | "iwidgets" namespace has a bunch of
 could use simple names like:     | classes within it.  You must always
 could use simple names like:     | classes within it.  You must always
                                  | refer to these classes with qualified
                                  | refer to these classes with qualified
                                  | names, like this:
                                  | names, like this:
                                  |
                                  |
 Labeledwidget::alignlabels ...   | iwidgets::Labeledwidget::alignlabels ...
 Labeledwidget::alignlabels ...   | iwidgets::Labeledwidget::alignlabels ...
 Pane #auto                       | iwidgets::Pane #auto
 Pane #auto                       | iwidgets::Pane #auto
                                  |
                                  |
                                  |
                                  |
 In itcl2.2, the "global"         | In Tcl8.0, the "variable" command is
 In itcl2.2, the "global"         | In Tcl8.0, the "variable" command is
 command was used to access       | used to access variables in a namespace:
 command was used to access       | used to access variables in a namespace:
 variables in a namespace:        |
 variables in a namespace:        |
                                  |
                                  |
   namespace foo {                | namespace eval foo {
   namespace foo {                | namespace eval foo {
       variable x 0               |     variable x 0
       variable x 0               |     variable x 0
       proc example {} {          |     proc example {} {
       proc example {} {          |     proc example {} {
           global x               |         variable x
           global x               |         variable x
           return $x              |         return $x
           return $x              |         return $x
       }                          |     }
       }                          |     }
   }                              | }
   }                              | }
                                  |
                                  |
                                  |
                                  |
 public itk_component add...      | itk_component add ...
 public itk_component add...      | itk_component add ...
 protected itk_component add...   | itk_component add -protected ...
 protected itk_component add...   | itk_component add -protected ...
 private itk_component add...     | itk_component add -private ...
 private itk_component add...     | itk_component add -private ...
                                  |
                                  |
                                  |
                                  |
 OTHER DIFFERENCES
 OTHER DIFFERENCES
------------------------------------------------------------------------
------------------------------------------------------------------------
- You can now use instance variables (along with the usual common
- You can now use instance variables (along with the usual common
  variables) with the "scope" command.  Thus, you're no longer forced
  variables) with the "scope" command.  Thus, you're no longer forced
  to use the trick with a common array like:  [scope modes($this)]
  to use the trick with a common array like:  [scope modes($this)]
- All widget/mega-widget access commands (e.g., ".foo.bar") are
- All widget/mega-widget access commands (e.g., ".foo.bar") are
  installed in the global namespace.  Therefore, they can be accessed
  installed in the global namespace.  Therefore, they can be accessed
  from any namespace context.
  from any namespace context.
- The [incr Widgets] package used to be loaded by default.  You must
- The [incr Widgets] package used to be loaded by default.  You must
  now use the "package require" command to load it explicitly:
  now use the "package require" command to load it explicitly:
    package require Iwidgets              <-- loads the lastest (iwidgets3.0.0)
    package require Iwidgets              <-- loads the lastest (iwidgets3.0.0)
    package require -exact Iwidgets 2.2   <-- loads the older release
    package require -exact Iwidgets 2.2   <-- loads the older release
- Command/variable names are now reported with fully-qualified names
- Command/variable names are now reported with fully-qualified names
  in "info" inquiries and in error messages.
  in "info" inquiries and in error messages.
- No public/protected/private declarations outside of class definitions
- No public/protected/private declarations outside of class definitions
- The "scope" command used to be more or less the same as the "code"
- 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
  command.  In itcl3.x, "scope" is only for variables, and if a variable
  is not recognized, you'll get an error.
  is not recognized, you'll get an error.
- The "code" command used to return a value like "@scope ...".  It now
- The "code" command used to return a value like "@scope ...".  It now
  returns "namespace inscope ...", to be compatible with Tcl8.
  returns "namespace inscope ...", to be compatible with Tcl8.
- The prototypes for Itcl_RegisterC and Itcl_FindC have changed.  You
- The prototypes for Itcl_RegisterC and Itcl_FindC have changed.  You
  can now include ClientData when you register C functions.  Also, there
  can now include ClientData when you register C functions.  Also, there
  is a new Itcl_RegisterObjC function for (objc,objv)-style command
  is a new Itcl_RegisterObjC function for (objc,objv)-style command
  handlers.
  handlers.
 
 

powered by: WebSVN 2.1.0

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