View · Search · Index
No registered users in community xowiki
in last 10 minutes

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

From: Stefan Sobernig <stefan.sobernig_at_wu.ac.at>
Date: Mon, 13 Feb 2012 10:51:55 +0100

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 _at_ Object to
> store meta information for IDE.

> All just remove the colons from meta descriptions
>
> For example
> _at_ ::IDE::Browser idemeta component IDEBaseGUI
>
> to
>
> _at_ 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 _at_ object which takes care of mangling
and redirecting ::-qualified names, for example like this:

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

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

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

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

_at_ ::foo; # trapped by filter + unknown

::_at_ filter delete asMetaDescription

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

Assuming that the _at_ 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