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

Weblog Page

Showing 541 - 550 of 1561 Postings (summary)

[Xotcl] Automatic caching / XOTcl _at_ Wiki

Created by hypermail2xowiki importer, last modified by Stefan Sobernig 02 Jan 2017, at 11:15 PM

From: Kristoffer Lawson <setok_at_fishpool.com>
Date: Wed, 21 Feb 2001 04:03:21 +0200 (EET)

I built a small class called Cacheable that can be joined with other
classes and objects. With it you can specify certain methods from which
the returned result should be cached (and for how long). You can also
specify invalidation methods which cause the object's cache to be
empties. All this happens transparently from the methods' point of view.

I put the code up at the Tcler's Wiki:

http://mini.net/cgi-bin/wikit/1298.html

If anyone else has some neat examples, it might be a good idea to add them
to the XOTcl page I put up there:

http://mini.net/cgi-bin/wikit/1297.html

         - ---------- = = ---------//--+
         | / Kristoffer Lawson | www.fishpool.fi|.com
         +-> | setok_at_fishpool.com | - - --+------
             |-- Fishpool Creations Ltd - / |
             +-------- = - - - = --------- /~setok/

[Xotcl] xotcl and tclkit on win32

Created by hypermail2xowiki importer, last modified by Stefan Sobernig 02 Jan 2017, at 11:15 PM

From: Brian Theado <btheado_at_columbus.rr.com>
Date: Wed, 17 Jul 2002 23:05:52 -0400

Does anyone have an xotcl.dll built against Tcl 8.4 they are willing to
share? I would like to use XOTcl with tclkit on windows. The latest tclkit
is based on Tcl8.4b1 but the xotcl.dll available on the xotcl web page is
built agains Tcl 8.3.

There was a thread about xotcl and tclkit back in October
(http://alice.wu-wien.ac.at/pipermail/xotcl/2001-October/thread.html). It
seems that the stubs enabled shared library works only when used with the
same version of Tcl that it was built against. That still seems to be the
case.

I tried building myself and was successful in Linux. I get compile errors
using mingw on windows (The error is something like "initializer element is
not constant" in many places in xotclStubInit.c. They look like constants
to me as they are just references to function names). I also tried
cross-compiling from Linux with the same compile errors.

Thanks,
Brian Theado

[Xotcl] XOTcl 1.3.5 available

Created by hypermail2xowiki importer, last modified by Stefan Sobernig 02 Jan 2017, at 11:15 PM

From: Gustaf Neumann <neumann_at_wu-wien.ac.at>
Date: Sat, 15 Jan 2005 01:49:11 +0100

Dear XOTcl Community,

Below is the announcement of XOTcl 1.3.5. This is mostly a maintenance
and fix release.
Besides these fixes, the biggest change makes the non positional
argument processing
more compliant to the one of OpenACS. One can write now
            % Object o
            % o proc foo {-x:boolean -y a b} { ...}
instead of
            % ...
            % o proc foo {-x:boolean -y} {a b} { ...}
Currently, both variants are supported, the latter variant is deprecated and
will be removed in the future.

This version is also a prerequirement of the soon to be released XOTcl
package for OpenACS (integrated with the api and code browser of OpenACS).

best regards
-gustaf neumann
-----
Major changes relative to 1.3.4 are:

  - Qualitative Improvements

     * Improved code quality:
       + fixed possible segmentation violations in non positional
         argument handling
       + moved the Serializer into a namespace such that
            % package req XOTcl
            % package req xotcl::serializer
            Serialize ....
         works without namespace imports (the Serializer is
         still auto-exported, but this will change in the future)
       +

     * Improved Functionality
       + Non-positional arguments can be used in the same argument
         list as positional ones (more compliant with OpenACS).
         One can write now
            % Object o
            % o proc foo {-x:boolean -y a b} { ...}
         instead of
            % ...
            % o proc foo {-x:boolean -y} {a b} { ...}
         All introspection commands will work like before.
         The old syntax (with the additional argument) is deprecated
         and will be dropped in the future.

       + Serializer: support for objects with parent namespaces, which are
         not xotcl objects

       + additional instproc for ::xotcl::Class allinstances
         to return all instances for the actual class

Re: [Xotcl] [self class] inside [eval]

Created by hypermail2xowiki importer, last modified by Stefan Sobernig 02 Jan 2017, at 11:15 PM

From: Uwe Zdun <uwe.zdun_at_wu-wien.ac.at>
Date: Mon, 06 Sep 2004 16:06:16 +0200

Hi again,

well the problem here is the same as before. "eval" passes the control
to the Tcl eval command implementation.
That is, all what is called inside an "eval" in an object's namespace
bypasses the XOTcl dispatcher.
So the callstack entries are not correct. also filters/mixins do not
work here.
You should always use the XOTcl invocation syntax "objName methodName
args", like:

$newOb eval {
 $newOb doStuff
}

I would like to make it impossible to call doStuff directly here, as in
the example below, but this would
require changes to the Tcl core or has a performance impact; so we chose
to live with the problem that
procs can be called directly via the namespace

Uwe




Kristoffer Lawson wrote:

>
> Still looking for an official explanation for the operations of [eval]
> (and other stuff I posted), but here's another one. The code follows:
>
> package require XOTcl 1.3
> namespace import xotcl::*
>
> Class Foo -parameter doors
>
> Foo instproc init {req} {
> puts $req
> }
>
>
> Object ob
>
> set newOb [Foo new -childof ob hello -doors 4]
> puts "Doors: [$newOb doors]"
>
> $newOb proc doStuff {} {
> puts "class: [self class]"
> set newOb [[self class] new -childof [self] whatevah -doors 3]
> puts "Doors: [$newOb doors]"
> }
>
>
> $newOb doStuff
>
> #$newOb eval {
> # doStuff
> #}
>
> This version correctly states that the class for [self class] is an
> empty string. However, if I comment out the "eval" version and use it
> instead, [self class] gives me "::xotcl::Object".
>
> / http://www.fishpool.com/~setok/
> _______________________________________________
> Xotcl mailing list - Xotcl_at_alice.wu-wien.ac.at
> http://alice.wu-wien.ac.at/mailman/listinfo/xotcl


-- 
Uwe Zdun
Department of Information Systems, Vienna University of Economics
Phone: +43 1 313 36 4796, Fax: +43 1 313 36 746
zdun_at_acm.org, uwe.zdun_at_wu-wien.ac.at

[Xotcl] Abstract class question

Created by hypermail2xowiki importer, last modified by Stefan Sobernig 02 Jan 2017, at 11:15 PM

From: Laurent Duperval <laurent.duperval_at_netergynet.com>
Date: Mon, 11 Dec 2000 08:11:41 -0500 (EST)

Hi,

How do you enforce abstract methods? For example:

Class Foo
Foo abstract instproc procdef args

Class Bar -superclass
Bar instproc proc2

Bar barObj

I would like an error to be thrown at the "Bar barObj" line because the Bar
object doesn't define the procdef instproc. Is this rule enforceable? Is my
only way at it to use assertions?

Thanks,

L

-- 
MY EMAIL ADDRESS HAS CHANGED --> UPDATE YOUR ADDRESSBOOK
Laurent Duperval                   "Montreal winters are an intelligence test,
Netergy Networks - Java Center            and we who are here have failed it."
Phone: (514) 282-8484 ext. 228                                   -Doug Camilli
mailto:laurent.duperval_at_netergynet.com           Penguin Power!

Re: [Xotcl] Request for XOTcl proc and var type ahead in tkcon

Created by hypermail2xowiki importer, last modified by Stefan Sobernig 02 Jan 2017, at 11:15 PM

From: John McGlaughlin <jmcglaug_at_cisco.com>
Date: Tue, 05 Apr 2005 16:30:13 -0400

That's correct Jeff,

I thought perhaps it might be possible but could see how it might be a
performance hit
cept on the dual opterons it is quite fast.

perhaps if it were to be implemented it could be a switch to enable it?

Though it sounds like there are no cycles for such a feature.

XOTcl is cool and becoming more popular.

Thanks
John

Jeff Hobbs wrote:

>John McGlaughlin wrote:
>
>
>>Can an extension be added to tkcon so that the interpreter becomes aware
>>of XOTcl proc, instprocs and associated vars for type ahead capability.
>>
>>
>
>tkcon only does the "first" level of expansion for procs. I
>assume you are looking for object instrospection that will
>expand methods and/or vars then?
>
>
>
>>Lazy,
>>
>>
>
>That I understand well. ;)
>
>Jeff
>
>
>

Re: [Xotcl] proper way to access xotcl classes

Created by hypermail2xowiki importer, last modified by Stefan Sobernig 02 Jan 2017, at 11:15 PM

From: Matthew Smith <chedderslam_at_gmail.com>
Date: Wed, 7 May 2008 15:48:56 -0500

Thank you, Gustaf. Makes sense.

Is there anyway to call a method besides doing a "puts".

Putting in:
  s1 push a
results in an error, however I can do:
puts [s1 pop]

I would think that there would be a way to call a method without
outputiing. Is there one?

[Xotcl] How to overload Class destroy?

Created by hypermail2xowiki importer, last modified by Stefan Sobernig 02 Jan 2017, at 11:15 PM

From: Zoran Vasiljevic <zv_at_archiware.com>
Date: Tue, 4 Jan 2005 16:35:29 +0100

Hi!

What I want to achieve is to get informed each time a Class is getting
destroyed. I do need to know the name of the class and its calling
environment (namespace).

What I did is:

Class create ::xotcl::_destroyer -instproc destroy {args} {
   puts "DESTROY '[self class]'"
   puts "DESTROY '[self calledclass]'"
   puts "DESTROY '[self callingclass]'"
   next
}
Class instmixin ::xotcl::_destroyer

Now...

Class Dummy
Dummy destroy

... gives ...

DESTROY '::xotcl::_destroyer'
DESTROY '::xotcl::Object'
DESTROY ''


What I expected to get was "DESTROY 'Dummy'" or "DESTROY '::Dummy'"
but this does not happen. Why?

Thanks,
Zoran

[Xotcl] XOTcl and Tcl 8.6

Created by hypermail2xowiki importer, last modified by Stefan Sobernig 02 Jan 2017, at 11:15 PM

From: Koen Danckaert <koen_at_retarget.com>
Date: Mon, 08 Feb 2010 18:17:18 +0100

Dear XOTcl developers,

I'm trying to use XOTcl (1.6.5) with Tcl8.6.

Apparently XOTcl does not compile with Tcl8.6, but on Linux, I can get it to work by using a version compiled for Tcl8.5.4.

However, this is not the case on Windows: loading XOTcl will make Tcl8.6 crash there.

I also tried to use the xotcl165.dll provided by Activestate in the Tcl8.6b1 distribution. This seems to work with Tcl8.6b1 indeed, but not with newer versions of Tcl fetched from CVS (which I need).

Is it possible today to use XOTcl in a recent Tcl8.6 ?
Or are there any plans to update XOTcl ?

Best regards,
Koen Danckaert

Re: [Xotcl] Incorrect behavior?

Created by hypermail2xowiki importer, last modified by Stefan Sobernig 02 Jan 2017, at 11:15 PM

From: Gustaf Neumann <neumann_at_wu.ac.at>
Date: Wed, 29 Jun 2011 21:11:39 +0200

Dear Victor,

an attribute and an instance variable are two different things with
potentially different life-times.

- The attribute provides information about instance variables
    and their properties (such as e.g. default values, which are
    used when variables are to be created, or methods to access
    the variable, etc.).
- The instance variables keep the actual value, they can be
   independently set and unset by standard Tcl commands.

Therefore, changing the default value of an attribute does not change
its actual value.
The same holds for class-level attributes and object-level attributes.

See e.g.
========================
% Object create o {set :a 1}
::o
% o attribute {a oldvalue}
::o::a
% o a
1
========================

However, in some respects the object-level attributes are different from
the class level attributes: In contrary to the class-level attributes,
the object-level attributes check at definition time of the attribute,
if an according instance variable exists. If not, it creates the
instance variable with the default value. Probably therefore, you
assumed, that the provided value is used to set always the instance
variable (maybe influenced by Tcl's "variable" command).

Since the attribute and the instance variable have different life-times,
deleting the attribute does the fuzz with the the instance variable.
Note that after deleting the attribute, the instance variable still
exists (see last command below).
====================================
% Object create o {:attribute {x 1}}
::o::per-object-slot::x init methodname=x
::o
% o eval {set :x}
1
% o x
1
% o delete attribute x
% o x
::o: unable to dispatch method 'x'
     while executing
"o x"
% o eval {set :x}
1
====================================

Note, that the same holds as well for class-level attributes (changing
default values, deleting attributes in class level attributes does not
effect the variables in already created instances).

One can certainly argue, that the behavior for object-level and
class-level attributes does not have to be the same, and that e.g. the
life-time of object-level attributes and instance variables should be
stronger tied together (defining a object-level attribute should
immediately create/overwrite instance variables, altering the default
should change its value, deleting object-level attributes should remove
the variables, etc.).

One could define currently mixins that could achieve this strong
binding. Note, that the other way round, if we hard-wire the strong
binding, it is much more effort to get rid of this strong interaction.
Note as well, that per-object attributes are a quite heavy-weight
machinery for setting variables. I would certainly not recommend to use
per-object attributes each time a variable has to be created, at least
not in in performance critical or memory critical situations.

I could see at least 3 scenarios for objects, that require sometimes
instance attributes:

a) lightweight: just use tcl-variables, no attributes

       Object create o {
          set :x 1
          :public method foo {} {return ${:x}}
        }

b) middleweight: just tcl-variables + setters/checkers, no attributes

       Object create o {
          set :x 1
          ::nsf::method::setter [self] x:integer
          :public method foo {} {return ${:x}}
        }
        % o x
         1
         % o x a
          expected integer but got "a" for parameter "x"

c) heavyweight: use attributes

       Object create o {
          set :x 1
          :attribute {x:integer,1..n 0} {set :incremental 1}
          :public method foo {} {return ${:x}}
        }

        % o x
        1
        % o x add 10
        10 1
         % o x add 100
         100 10 1
         % o x
         100 10 1
         % o x {1 hello 2}
         invalid value in "1 hello 2": expected integer but got "hello"
for parameter "value"

For (b) the middleweight version, we have currently no nice method-based
interface.
Just in the case of (c) with the incremental interface, slot objects are
needed
(as well in other cases, where some additional meta-data is needed, such as
e.g. persistency data, etc.).

We could do
  (1) bind the life-time of per-object attributes to the life-time of
instance variables
  (2) create not always slots, when attribute is used, but only when
needed.

The case (2) could be tricky for "delete attribute", but at least, for
often used per-object attributes this could be a win. What is your
primary reason for using "attribute" instead of tcl vars? do you use the
incremental setters?


-gustaf neumann


Am 29.06.11 19:52, schrieb Victor Mayevski:
> In my code I have objects that need some attributes only sometimes.
> So, that was my attempt to reduce the code and not have to test for
> the existence of that attribute but just re-create it. In this case, I
> ended up just having that attribute permanently in all objects at all
> times. It is not that I didn't have any other way of doing it, it is
> just that I thought it would have been an elegant and short way of
> doing it.
>
>
> Here is another curious code that could be a bug, at least it doesn't
> seem to behave as expected:
>
> % Object create o
> ::o
> % o attribute {a oldvalue}
> ::o::a
> % o a
> oldvalue
> % o delete attribute a
> % o a
> ::o: unable to dispatch method 'a'
> % o attribute {a newvalue}
> ::o::a
> % o a
> oldvalue
>
>
>
> Also, is it possible for "object delete attribute a" to not complain
> if the attribute does not exist, may be via "-nocomplain" switch or
> just by default?
>
> Thanks,
>
> Victor
>
>
> On Wed, Jun 29, 2011 at 3:51 AM, Stefan Sobernig
> <stefan.sobernig_at_wu.ac.at> wrote:
>> Victor,
>>
>>>> %Object create o
>>>> ::o
>>>> %o attribute {a oldvalue}
>>>> ::o::a
>>>> %o a
>>>> oldvalue
>>>> %o attribute {a newvalue}
>>>> ::o::a
>>>> %o a
>>>> oldvalue
>> Forgot to ask: Why do you take this path (changing the default of the
>> attribute slot) in the first place? If you want "a" to have the value
>> "newvalue" assigned, why don't you simply say:
>>
>> o a newvalue
>>
>> //s
>>
>>
>>
> _______________________________________________
> Xotcl mailing list
> Xotcl_at_alice.wu-wien.ac.at
> http://alice.wu-wien.ac.at/mailman/listinfo/xotcl


-- 
Univ.Prof. Dr. Gustaf Neumann
Institute of Information Systems and New Media
WU Vienna
Augasse 2-6, A-1090 Vienna, AUSTRIA

Next Page