[Xotcl] Annonce: XOTcl 0.85 released - compatible with XOTcl 2.0

Stefan Sobernig stefan.sobernig at wu.ac.at
Mon Feb 13 10:51:55 CET 2012


Artur,

> The new release of XOTclIDE 0.85 is [...] Compatible with XOTcl 2.0

Many thanks for your efforts, this is much appreciated!

> Indeed XOTcl 2.0 seems to be the most backward compatible version ever
> of XOTcl. I was quite surprised that my many thousand of XOTcl code runs
> without problems with XOTcl 2.0. So version difference 1.6 to 2.0 seems
> to be most internal nature.

This is good news for us!

> The method names can not start with : but it was used in @ Object to
> store meta information for IDE.

> All just remove the colons from meta descriptions
>
> For example
> @ ::IDE::Browser idemeta component IDEBaseGUI
>
> to
>
> @ IDE::Browser idemeta component IDEBaseGUI

If you allow for a suggestion: You may easily offer a backward 
compatibility patch here, to take this tiny burden of XOTclIDE users:

Register a filter method for your @ object which takes care of mangling 
and redirecting ::-qualified names, for example like this:

xotcl::Object create ::@ -proc unknown {selector args} {
   puts stderr "TRAPPED: ::$selector"
}

proc ::foo {} {
   puts stderr "PROC called"
}

@ ::foo; # the proc ::foo is called

#
# Provide for backward compatibility of meta descriptions ...
#
::@ proc asMetaDescription args {
   set componentName [self calledproc]
   if {[string match {::*} $componentName]} {
     my [string trimleft $componentName :] {*}$args
   } else {
     next
   }
}
::@ filter add asMetaDescription

@ ::foo; # trapped by filter + unknown

::@ filter delete asMetaDescription

@ ::foo; # the proc ::foo is called, again

Assuming that the @ processing is not a performance-critical evaluation 
path in XOTclIDE component scripts, this is an acceptable approach. You 
could optimise the code further, by inlining the component handling from 
unknown into asMetaDescription ... rendering unknown obsolete.

//stefan


More information about the Xotcl mailing list