Consider the following program fragment:(Win 98 ver 0.85) where:
1. X has subclasses B and C
2. X has instproc m
3. object a mixes in {C B}
4. message p sent to object a(see code below)
The code produces as answer:
method p of A
method m
method m of A
I expected:
method p of A
method m
method m
method m of A
Apparently only the method m inherited by C is executed
while the method m inherited by B is not!!
Any help to clarify this situation is appreciated.
Thanks.
Regards,
--sheik
-----------------------------------------------------------------
# Code to illustrate above.
Class X
X instproc m args {
puts "method m"
next
}
Class A
A instproc m args {
puts "method m of A"
next
}
A instproc p args {
puts "method p of A"
[self] mixin {C B}
[self] m
}
Class B -superclass X
Class C -superclass X
A a
a p
Consider the following scenario:
A, B and C are classes.
A has instproc m defined.
B is a sub-class of A.
C c
c mixin B
Question: How in instproc m can I get the name
of the mixin class, that is, B?
Any help will be appreciated.
Regards,
sheik.
Is there a way for one filter (A say) to change the name of a method
and pass this new method name with the same args to the next
filter in sequence(B say)?
Any help would be appreciated.
Thanks.
Regards,
sheik.
I've been maintaining debian packages of xotcl for some time now and
thought it might be useful to mention that on this list too.
Xotcl 0.85.2 is currently in debian's "testing" distribution and 0.85.3
is in "unstable". If you use debian, please test the packages and give
me feedback if you find that something doesn't work.
If you want the packages for debian stable ("potato"), drop me a line.
Situation:
I create a class "C" with instproc "foo".
An object is created from C called "ob".
Problem:
The commands "ob info procs", "ob info args" and "ob info body" do not
work as I would expect them to. In particular, there doesn't seem to be a
way of finding out the body and arguments for the instproc "foo" from the
object. I could do this by asking the class, but I specifically would
like a uniform way to do this, without caring whether the methods are
inherited or not. Is this intended? Why?
% package require XOTcl
0.85
- ---------- = = ---------//--+
| / Kristoffer Lawson | www.fishpool.fi|.com
+-> | setok(a)fishpool.com | - - --+------
|-- Fishpool Creations Ltd - / |
+-------- = - - - = --------- /~setok/
Dear XOTcl comminity,
here comes the annoucement of patchlevel 3 for XOTcl.
best regards
-gustaf
PS: Some other good news: ActiveState is planning to include XOTcl in the
next ActiveTcl release....
========================================================================================
XOTcl 0.85.3
************
RECENT CHANGES relative to 0.85p2 are:
- Speedup for parameter methods:
Methods for accessing parameters are now 4 to 5 times faster.
In the following example, "name" and "age" are parameters:
Class Person -parameter {{age 0} name}
Person p1 -age 99 -name -gustaf
puts [p1 age]
setting and retrieving of parameters has now roughly the same
speed as the set methods (about 20% faster than instvars)
- Reduced memory consumption for objects and classes:
The size of XOTclObject structure went from 172 bytes
to 68 bytes by
* allocating assertion structures on demand, and
* by and by omitting in the default setup metadata
10 thousand XOTcl objects consume now about 7 MB of memory.
There is still little potential for savings in the
C-structure (by using bitmasks), but most of the memory
consumed by XOTcl objects are in the tcl-memory structures for
namespaces etc.
- Support for AOLserver:
XOTcl is now prepared for use in the AOL-server. The stubs for
AOL-server are integrated in XOTcl (many thanks to
Zoran Vasiljevic). The required patch for the AOL-Server
is available from http://media.wu-wien.ac.at/download.html#aol
- Stub-library support:
XOTcl supports now the stub library. This means that
it is less dependent on particular Tcl implementations.
The support was quite tricky since some commands used by XOTcl
(like Tcl_IncrObjCmd, Tcl_UpvarObjCmd, ...) are
not exported by the stub library, and the solution
has to work in the multithreaded AOL-server environment)
- various small optimizations and code cleanups
- some actiweb fixes (agent migration was broken)
For more details, please check the ChangeLog file.
Best regards,
Gustaf Neumann
Below is sample code to illustrate a problem I
am having with filters.
1. Object a is sent the message mb(not an instproc) of A
2. Filter af of object a intercepts and
dispatches method mbb to object b
3. Filter bf of object b intercepts and
redispatches method maa to object a
4. This time the filter af does not intercept method maa!!
The method maa is sent directly to object a with
the resulting error: object a unable to dispatch
method maa.
Can anyone assist me in explaining what is happening here?
------------------------------------------------------------
#Code: Win 95 version 0.85
Class A -parameter {delegate}
A instproc af args {
set method [self calledproc]
if {[[self] exists delegate]} {
set del [[self] set delegate]
if {$method == "maa"} {
return [eval $del mbb]
}
if {$method != "ma"} {
return [eval $del $method $args]
}
}
next
}
A filter {af}
A instproc ma args {
puts "method ma of A"
}
Class B
B instproc bf args {
set sender [self callingobject]
set method [self calledproc]
puts "method is: $method"
if {$method == "mb"} {
return [eval $sender maa]
}
next
}
B filter bf
B instproc mb args {
puts "method mb of B"
}
B instproc mbb args {
puts "method mbb of B"
}
#Test case
B b
A a
a delegate b
#a ma
a mb
Hi!
There is new 0.18 version of XotclIDE
http://www.xdobry.de/xotclide
Main Changes:
1. test framework and small GUI for automatic unit tests.
2. same test classes for xotclIDE (many bugs could be found and destroyed)
3. changes browser. (do diff like work for objects versions)
4. Same new function for method editing. Next Prev functions to browse methods
like in hypertext browser (with viewing history). Spawned windows for method
editing.
5. Wizard dialog for creating or redefining classes
6. Many additional small functions.
Artur Trzewik
Class A is a derived class of meta-class Consultation.
In the filter conFilter I would like to obtain
the class of the object that received the message "m"
when invoking the command: [a m 123]. That is, the
class of the original receiver of method "m".
(Please see code below).
Thanks for any help.
Regards
sheik
.........................................................
#Code:
Class Consultation -superclass Class
Consultation instproc conFilter args {
set method [self calledproc]
#The following is of course not correct!
#[self class] evaluates to Consultation;
#I need it to evaluate to A. Help!!
if {[[self class] info instprocs $method] == ""} {
if { [[self] exists delegate] } {
return [eval [[self] set delegate] $method $args]
}
}
next
}
Consultation instproc init args {
[self] instproc setDelegate {d} {
[self] set delegate $d
}
next
[self] filterappend [self class]::conFilter
}
Consultation A -parameter delegate
A instproc m {x} {
puts "[self] [self class] [self proc] $x"
return [next]
}
Class B
B instproc m {x} {
puts "[self] [self class] [self proc] $x"
return [next]
}
A a
B b
a setDelegate b
# send message m to object a
puts "result = [a m 123]"
Hi,
Alexis Gambis, a student having spent his Internship with us at Pasteur,
has just finished his project :
Interaction between the User and Heijne's membrane topology prediction
algorithm Toppred
We thought that the mixin technique could be useful to enhance the
interaction between user and algorithm by the mean of supplemental
user input taken into account without modifying the algorithm.
His results are summarized here:
http://www-alt.pasteur.fr/~letondal/biok/usermixin.html
--
Catherine Letondal -- Pasteur Institute Computing Center