Index: doc/migration1-2.html =================================================================== diff -u --- doc/migration1-2.html (revision 0) +++ doc/migration1-2.html (revision 68a446ad7ec32cbca27d0715cd58f264c1df3dde) @@ -0,0 +1,199 @@ + + +Migration Guide from XOTcl 1 to XOTcl 2 + + + + +

Introduction

+ +... general text, maybe partly from slides/paper .... + +

Supporting XOTcl 1 in XOTcl 2

+ +

+... multiple object systems .... +

+::xotcl::use xotcl1 +

+::xotcl::use xotcl2 +

+describe, what ::xotcl::use does + +

XOTcl 1 Idioms in XOTcl 2

+ +

Defining Objects and Classes

+ + + + + + + + + + + + + + + + + + +
XOTcl 1XOTcl 2
Class ClassNameClass create ClassName
Object ObjectNameObject create ObjectName
::xotcl::Class ClassName::xotcl2::Class create ClassName
::xotcl::Object ObjectName::xotcl2::Object create ObjectName
+ +

Defining Methods

+ + + + + + + + + + +
XOTcl 1XOTcl 2
Class C
+ C instproc foo args {...}
+ C proc bar args {...}
+
Class create C {
+   .method foo args {...}
+   .object method bar args {...}
+ }

+ Class create C
+ C method foo args {...}
+ C object method bar args {...}
+
Object o
+ o set x 1
+ o proc foo args {...}
+
Object create o {
+   set .x 1
+   .method foo args {...}
+ }

+ Object create o
+ # recommendation missing: alternatives:
+ #    o eval {set .x 1}
+ #    ::xotcl::setinstvar o x 1
+ o method foo args {...}
+
+ + +

Invoking Methods

+ + + + + + +
XOTcl 1XOTcl 2
Class C
+ C instproc foo args {...}
+ C instproc bar args {
+   my foo 1 2 3 ;# invoke own method
+   o baz        ;# invoke others method
+ }
+ Object o
+ o proc baz {} {...}
+
Class create C {
+   .method foo args {...}
+   .method bar args {
+      .foo 1 2 3 ;# invoke own method
+      o baz      ;# invoke others method
+   }
+ }
+ Object create o {
+   .method baz {} {...}
+ }
+
+ + +

Accessing Instance Variables from Method Bodies

+ + + + + + + + + + + + + + + + + + +
XOTcl 1XOTcl 2
my set varname valueset .varname value
set newVar [my set otherVar]set newVar [set .otherVar]

+ set newVar ${.otherVar}
+
my instvar newVar
+ set newVar value
+
set .newVar value
my exists varnameinfo .varname
+ +

Accessing Instance Variables of other Objects

+ + + + + + + + + + + + + + + + + + +
XOTcl 1XOTcl 2
someObject set varname value...
set newVar [someObject set otherVar]set newVar [...]
+
someObject instvar newVar
+ set newVar value
+
::xotcl::instvar -object someObject newVar
+ set newVar value
someObject exists varname... do we have to keep exists for this reason? ...
+ + +

Introspection

+

Predefined Methods

+

Dispatch, Aliases, etc.

+

Method Protection

+ + +
+
+ Last modified: Fri Jan 1 18:19:12 CET 2010 +