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

Weblog Page

Filtered by date 2017-01-02, 1511 - 1520 of 1541 Postings (all, summary)

[Xotcl] problem with filter & destroy

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, 28 Feb 2001 03:39:31 +0200 (EET)

(version: 0.83)

Class Foo

Foo instproc destroy {args} {
  puts "destroy args: $args"
  next
}

Foo instproc method {args} {
  puts "method args: $args"
  next
}

Foo instproc filterProc {args} {
  puts "filter args: $args"
  next
}

Foo filter filterProc

[~] ob method suk
filter args: suk
method arg: suk

[~] ob destroy blah
filter args: blah
destroy args:

Without the filter the arguments to destroy are sent as normal. So the
filter is having some effect on how destroy is handled. Also, I've
received the following error when playing around with this situation:

invalid command name "self"
    while executing "self"
    invoked from within "puts stderr "[self]: Error in instproc destroy
         $::errorCode $::errorInfo""
    invoked from within
"ob destroy data"

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

Re: [Xotcl] error with slots?

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

From: Cristian Chaparro <cristian.chaparro_at_univ-perp.fr>
Date: Wed, 09 Jun 2010 15:22:30 +0200

All,
The problem was that, somehow, I managed to change "-d" in -default to
"D"... I read several times the code and I didn't see it until now.

Sorry for the noise!
Cristian

On 06/09/2010 02:51 PM, Cristian Chaparro wrote:
> Hi all,
> I would like to have some help on an error message that I got recently.
> The code has been working for about 2 years without giving any error and
> today it didn't want to start. I have XOTcl 1.6.6 with tcl 8.5.8 on a
> debian machine.
>
> The error message:
> wrong # args: should be "init" during '::Sim4 slots'
>
> produced when sourcing this code
>
> Class Sim4 -slots {
> Attribute file1
> Attribute file2
> Attribute options Default ""
> }
>
> Sim4 instproc init {} {
> my instvar hits
> ...
> }
>
> Any help is greatly appreciated.
>
> Thanks
> Cristian
>
>
>

-- 
Ce message a été vérifié par MailScanner
pour des virus ou des polluriels et rien de
suspect n'a été trouvé.
CRI UPVD http://www.univ-perp.fr

[Xotcl] Re: [Xotcl] Re: [Xotcl] Probable bug: no method calls with "next" & init

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

From: Kristoffer Lawson <setok_at_fishpool.com>
Date: Tue, 6 Feb 2001 00:14:39 +0200 (EET)

On Mon, 5 Feb 2001, Gustaf Neumann wrote:

>
> The "-methods" are not executed by init, but by create . The Class
> allocs the objects, obtains default values, calls the "-methods" and
> finally calls init (if it was not triggered by -init in the "-methods").

Ah yes, of course. I know it's not init that does it, but I'm not thinking
of the proper call procedure. Naturally create would be called before any
init methods and it is the one doing that business (and not some abstract
feature of the language). Silly me... :P

> If you say that the execution of "whatever" should happen before
> init, and you want to magically add "-methods", i would recommend to
> refine the create method....

Yes, maybe that would be the best option. The issue stems from
the problem that I have a few different ways to create an instance
(and as I can only have one constructor I must do it some other way). This
is fine normally, but in this particular case a sub-class can only be
created in one manner and thus it should make an instance of itself
using one particular initialisation procedure of its super-class.
So if you have suggestions for that, I'd like to hear them. Overriding
create is one way, if nothing else.

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

[Xotcl] Mixins don't respect class hierarchy

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

From: Arthur Schreiber <schreiber.arthur_at_googlemail.com>
Date: Thu, 23 Feb 2012 11:29:04 +0100

Hello Gustaf,

playing around with mixins, I came across the following behaviour:

package require nx

nx::Class create TestMixin {
    :public method test {} {
        puts "mixin"
    }
}

nx::Object mixin TestMixin

nx::Class create TestClass {
    :public method test {} {
        puts "class"
    }
}

set test [TestClass new]
puts [$test info precedence]; # => ::TestMixin ::TestClass ::nx::Object
$test test; # => mixin

Is that intended? I would have expected that the class hierarchy of
::TestClass instances would look like "::TestClass ::TestMixin
::nx::Object".

Kind regards,
Arthur

Re: [Xotcl] nextto

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: Fri, 23 Jan 2015 23:56:53 +0100

Am 23.01.15 um 23:18 schrieb Victor Mayevski:
> Recently I looked over TclOO and noticed a "nextto" feature. It
> appears to be pretty useful and I supposed it should be trivial to
> implement it in NX. Any ideas how?
>
> Thanks,
>
> Victor

Dear Victor,

Such behavior can be achieved in nx via method handles, which are a
means to refer directly to specified methods. I would not recommend to
use such constructs in all programs, since this mechanism can break
certain contracts a programmer can otherwise rely on (e.g. mixin layers,
etc.).

The script below returns the following output
all the best

-g

::F.foo standard next
::E
::D
::C
::C DONE
::D DONE
::E DONE
::F.foo standard next DONE
===== handle = ::nsf::classes::D::foo
::D
::C
::C DONE
::D DONE



=======================================================
package require nx

nx::Class create C {
     :public method foo {} {
        puts [current class]; next puts "[current class] DONE"
     }
}
nx::Class create D -superclass C {
     :public method foo {} {
        puts [current class]; next; puts "[current class] DONE"
     }
}
nx::Class create E -superclass D {
     :public method foo {} {
        puts [current class]; next; puts "[current class] DONE"
     }
}
nx::Class create F -superclass E {
     :public method foo {} {
        puts "[current class].foo standard next"
        next
        puts "[current class].foo standard next DONE"
        set handle [D info method handle foo]
        puts "===== handle = $handle"
        : $handle
     }
     :create o1
}

o1 foo
=======================================================

[Xotcl] gdbm/sdbm/textfile database trouble

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

From: Walter Augustin <matto_at_matto.at>
Date: Thu, 16 Jun 2005 13:42:35 +0200

Hi!

I am quite new to [XO]Tcl and currently working on some scripts for Prof.
Neumann's OO programming class.
I run my scripts under Windows which has been working well so far - until I
tried to run the "Cached WebPage" which depends upon one out of three
offered storage resources.

In the slides, Prof. Neumann offers to use TextFile, Gdbm and Sdbm:

        package require xotcl::store::textfile; set DBClass Storage=TextFile
        #package require xotcl::store::gdbm; set DBClass Storage=Gdbm
        #package require xotcl::store::sdbm; set DBClass Storage=Sdbm

In the "Cache" class this should be used like this:

Class Cache
Cache instproc init {} {
  Storage=TextFile [self]::db ;# Erzeuge DB als Unterobjekt
  [self]::db open [self] ;# öffne DB mit aktuellen Namen des Objekts
  next
}

Now I tried all three possibilities, uncommenting lines and changing the
"Storage=Textfile|Gdbm|Sdbm" part of the script. The results leave me in
confusion, since the errors seem to be all different:

[TextFile:]
C:\Programme\tcl\scripts\stock>tclsh stock.xotcl
couldn't open "::cache": no such file or directory
    while executing
"::open $filename a+"
    (procedure "set" line 21)
    ::cache::db ::Storage=TextFile->set
    invoked from within
"[self]::db set $url [list date $date content $page]"
    (procedure "store" line 4)
    ::cache ::Cache->store
    invoked from within
"cache store $url $content"
    (procedure "loadPage" line 15)
    ::s1 ::CachedWebPage->loadPage
    invoked from within
"my loadPage "
    (procedure "getContent" line 3)
    ::s1 ::WebPage->getContent
    invoked from within
"my getContent"
    (procedure "getRate" line 4)
    ::s1 ::StockInfo->getRate
    invoked from within
"s1 getRate"
    (file "stock.xotcl" line 116)

[Gdbm:]
C:\Programme\tcl\scripts\stock>tclsh stock.xotcl
can't find package xotcl::store::gdbm
    while executing
"package require xotcl::store::gdbm"
    (file "includes.inc" line 4)
    invoked from within
"source includes.inc"
    (file "stock.xotcl" line 1)

(-> Okay, the package is missing at all. I could make Stefan Vogel's Tcl
wrapper port work - although the installation package was missing the
pkgIndex.tcl file which he mailed me separately, but the XOTcl extension
seems just not to be available under Windows. So, next I tried:)

[Sdbm:]
C:\Programme\tcl\scripts\stock>tclsh stock.xotcl
Open on '::cache::db' failed with '::cache'.
    ::cache::db ::Storage=Sdbm->open
    invoked from within
"[self]::db open [self] "
    (procedure "init" line 4)
    ::cache ::Cache->init
    ::Cache ::xotcl::Class->create
    ::Cache ::xotcl::Class->unknown
    invoked from within
"Cache cache "
    (file "stock.xotcl" line 87)

Source code is from Prof. Neumann:
http://nm.wu-wien.ac.at/Lehre/oo2/stockinfo.xotcl
I just commented out the package require Gdbm part and placed the three
variants (see above) in the head of the script ("includes.inc" script).
Plus, I replaced "Gdbm" in the Cache::init method by "TextFile" or "Sdbm" as
appropriate.

Sorry this got lengthy ... I wonder if any of you ran into this once and has
a hint for me. I'm stuck :( And sorry, I am a beginner, maybe I miss
something obvious.

Thanks in advance!

Walter

Re: [Xotcl] troubleshooting

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

From: Victor Mayevski <vitick_at_gmail.com>
Date: Sat, 27 Nov 2010 15:07:35 -0800

Thank you Gustaf, that fixed the error. There is an additional error:

can't find package xotcl::package
    while executing
"package require xotcl::package"
    (file "./library/xotcl/library/lib/makeDoc.xotcl" line 16)
make: *** [library/xotcl/doc/langRef-xotcl.html] Error 1

The error seems to be caused by missing pkgIndex.tcl file in
./library/xotcl/library/lib/


Thanks


On Fri, Nov 26, 2010 at 7:48 PM, Victor Mayevski <vitick_at_gmail.com> wrote:
> Hello Gustaf,
>
> I have the following problem when trying to compile NX on freshly
> installed Linux x86 system against latest TCL 8.6 from SourceForge
> CVS.
>
> ./generic/nsf.c: In function ‘MethodDispatchCsc’:
> ./generic/nsf.c:6959: error: too many arguments to function
> ‘tclIntStubsPtr->tclNRRunCallbacks’
> make: *** [nsf.o] Error 1
>
>
> Thank you
>

[Xotcl] Re: [Xotcl] Real value of meta-class

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

From: Kristoffer Lawson <setok_at_fishpool.com>
Date: Mon, 29 Jan 2001 20:18:50 +0200 (EET)

On Mon, 29 Jan 2001, Rick Hedin wrote:

>
> Is there an example where being a metaclass results in different output?

I'm not sure if the question is how metaclasses can be used? Personally
I've been thinking of a package that would transparently allow XOTcl
coders to use ITcl classes as if they were XOTcl classes. For that I would
use a metaclass ITclClass. When creating a clas with that like

ITclClass Foobar

It would search for the actual ITcl class called "Foobar", create an XOTcl
class "Foobar" with a filter installed that redirects everything to the
original ITcl class, and if instantiated does the appropriate work
for the object.

You could probably do this with mixins, but I don't think it would be
as beautiful.

I'm sure others have some interesting uses as well ;-)

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

[Xotcl] Xotcl IDE

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

From: Artur Trzewik <mail_at_xdobry.de>
Date: Thu, 1 Mar 2001 20:22:50 +0100

Hello

I learn Xotcl in my study time. A was a student of prof. Neumann.
Now I work with Smalltalk.
After I have get some experience with Smalltalk environments I noticed
that xotcl is ideal to build such developing systems as Smalltalk have.
It means it is dynamically and has introspection functionality.

I wrote the first Browsers now. It is the first attempt but it can
be already used for developing (or browsing Xotcl)

I named the application XotclIDE
the tar archive can be downloaded from

http://www.xdobry.de/xotclIDE

I am interested in suggestion for next developing.
Share your experience with xotclIDE

On my site are also another xotcl development (Database application xdobry)
with such goodies as
- factory classes for building gui from XML
- Xotcl database interface to mysql, postgres
- GUI builder (yes with drag and drop)
- Xotcl wrapper library for tk,tix
I plan to add it (after refactoring) to xotclIDE

=========================================
 Artur Trzewik
 http://www.xdobry.de
=========================================

Re: [Xotcl] Abstract class

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

From: Kristoffer Lawson <setok_at_scred.com>
Date: Fri, 4 Apr 2008 16:26:17 +0300

On 1 Apr 2008, at 23:35, Victor Mayevski wrote:
> Can somebody please update the XOTcl tutorial/reference to explain in
> detail what abstract class is and how to use it (examples of usage)?
> I've been looking everywhere and can't find the info.

I'm not a core XOTcl developer, but the general case for abstract
classes is that you want to have a superclass for a variety of other
classes and this superclass provides some of the methods, but not
all. The rest, or a small subset, can be specified as 'abstract'
methods. With these only the 'style' of the method is described --
what arguments it takes, what it is named, perhaps what it returns
and what it does. The sub-classes are then required to do the actual
implementation of these methods.

So say you have a general 'GraphOb' class. It has an abstract method
'draw'. It cannot draw itself, or anything else, but it expects the
sub-classes to implement this method. You might then have
'Rectangle' and 'Circle' which are subclasses of GraphOb and each of
these have a 'draw' method which draws the rectangle or circle on to
the screen.

Some classes might only have abstract methods...

Hope this explains it a bit.

            / http://www.scred.com/
            / http://www.fishpool.com/~setok/

Next Page