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

Weblog Page

Showing 1071 - 1080 of 1561 Postings (summary)

Re: [Xotcl] Passing a switch non-positional argument

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: Thu, 02 Mar 2006 02:32:56 +0100

Kurt,

passing around the actual values of the non-positional arguments
with next or with a forwarder is already very conveniant, but this
was not your question.

Passing unary non-pos arguments to some explicit method invocations
is some typing work, but straightforward. Passing a switch is painful.
Your example can be made somewhat shorter

    eval my p1 [expr {$sw? "-sw" : ""}] [list -opt $opt]

list is needed to protect the value of opt, if it contains e.g.
a $, spaces etc. But still, the preceding eval reminds me on the days
of otcl and does not win a beauty contest.

For your example, i would tend to use boolean non-pos-args instead.
We introduced the 0-argument switch mostly for oacs, which
uses a similar construct already for it's ad_proc. When one defines
in xotcl a public/private method with boolean, as in

   SomeClass method -private true foo {x y } ....

this looks rather stupid compared to

   SomeClass method -private foo {x y } ....

However, in many other situations, the notation with
the boolean argument as in

   obj -someflag on

or

  obj -debug true

looks from the aesthetical point of view quite ok to me.

-gustaf neumann
 

Re: [Xotcl] Testing for execution inside object

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, 3 Oct 2006 17:43:49 +0300

On 3 Oct 2006, at 14:55, Gustaf Neumann wrote:

> Kristoffer Lawson schrieb:
>> I need to know if the current procedural context is inside a
>> method (isntproc, proc, whatever) or not.
> can you explain in more detail, what the problem is?
> Note, that one can calls tcl procs from within xotcl methods, one
> can have evals, uplevels, etc.

I have a debug library that automatically displays information about
the proc or method in which it was called, to get the context for the
information. I want to check that if I'm running in an XOTcl method,
I also want to display the class for it.

>> What is the best way to do this? I used [self] to check by
>> catching the error, but that doesn't work particularly well if
>> another package happens to define the command [self].
> use ::xotcl::self

Good idea.

> "self" can be used to check whether the xotcl callstack is non-empty.

Yes, but only by wrapping it in a [catch].

> without promising to much, a sucommand"ismethod" for "self"
> retuning 0 or 1 depending whether the
> current stackframe is an xotcl method should be doable with little
> effort.

Worth considering. It's not perhaps high-priority, but might make it
neater.

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

Re: [Xotcl] Linking object instance variables to a widget -textvariable?

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

From: Ken Jones <ken_at_redsummit.net>
Date: Sat, 15 Nov 2003 23:37:24 -0800

At 11:12 AM 11/15/2003 +0100, Artur Trzewik wrote:
>The XOTcl are scoped (or can be scoped) in object namespace too.
>I use it as follow
>
>GUIClass instproc buildEntry win {
> my requireNamespace
> entry $win -textvariable [self]::entryValue
> my set entryValue {Init Value}
>}
>requireNamespace is required to build namespace for object.
>XOTcl object orientation is build (was build) on Tcl namespaces.

Ahh.... That's exactly what I was looking for. The documentation mentions that XOTcl is built on Tcl namespaces, but is a little vague in exactly how, aside from the discussion of aggregation. And I'd managed to overlook the documentation for the "requireNamespace" method. Actually, even after seeing your example, I don't think that the current "requireNamespace" method documentation is quite clear as to why it's needed. May I suggest adding a sentence or two to its description basically outlining an application of it, such as this, to help other newcomers to XOTcl understand its use?

Thanks for the clarification!

- Ken

Re: [Xotcl] Error or normal behavior?

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

From: Victor Mayevski <vitick_at_gmail.com>
Date: Tue, 7 Dec 2010 22:35:05 -0800

Thank you Gustaf,

I guess I just expected that things will be automatically tracked no
matter in which namespace I invoked the nx::Class command. I have not
used xotcl::Class before that's why I never seen this behaviour. The
namespace "nx" is so short so it made it very convenient to just enter
"nx::Class" on command line instead of using "namespace import".
Nevertheless, it was very educational. Thanks again.



On Tue, Dec 7, 2010 at 9:39 PM, Gustaf Neumann <neumann_at_wu-wien.ac.at> wrote:
> On 08.12.10 05:40, Victor Mayevski wrote:
>>
>> It came to my attention that [namespace import -force nx::*] is a
>> requirement and not an option, otherwise things don't work right.
>> Example:
>>
>> nx::Class create C
>> C method init args {puts [self]; next}
>> C create c
>> #error, commands "self" and "next" do not exist, but if I first do
>> [namespace import -force nx::*], everything works fine.
>
> well, if i take the first sentence literally, this is not true.
> there are several options:
>
> if one uses a plain tcl shell, one can use
>
> a)
>     package req nx
>
>     nx::Class create C
>     C method init args {puts [nx::self]; nx::next}
>     C create c
>
> b)
>     package req nx
>     namespace path nx
>
>     nx::Class create C
>     C method init args {puts [self]; next}
>     C create c
>
> c)
>     package req nx
>     namespace import nx::*
>
>     nx::Class create C
>     C method init args {puts [self]; next}
>     C create c
>
> Concerning (c): there is no need to use "-force", except
> these commands were already imported (e.g. from some
> other package).
>
> One can use alternatively the "nxsh" (tcl-file, which does a
>     package req nx
>     namespace import nx::*
> automatically) and then in the script file just
>
>     nx::Class create C
>     C method init args {puts [self]; next}
>     C create c
>>
>> This is not how I thought the namespaced commands should work. Is this
>> a feature or a bug? If not a bug, then it needs to be clearly
>> documented.
>
> I don't understand, what you expected. If you use just (a)
> then Tcl has no indication,  what "self" or "next" should be used.
> For unprefixed names, Tcl requires to have to use either
> "namespace import" or "namespace path".
>
> The behavior is the same as in XOTcl 1. XOTcl/nx do not play
> any magic games with namespaces, they just use the standard
> tcl behaviour.
>
> -gustaf neumann
>
>
>
>
>
> _______________________________________________
> Xotcl mailing list
> Xotcl_at_alice.wu-wien.ac.at
> http://alice.wu-wien.ac.at/mailman/listinfo/xotcl
>

Re: [Xotcl] TIP #257: Object Orientation for Tcl

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: Tue, 27 Sep 2005 02:09:24 +0200

Kristoffer Lawson schrieb:

>
> First, I want to say I'm very excited about this TIP. If this goes
> into 8.5 I'd really like to see a big concentrated effort to get Tcl
> back on the map.

hi folks,

a few words from our side: it's great news that more or less all of
xotcl (modulo name changes)
is contained in the TIP. This is the third version that i saw, and it
improved from
iteration to iteration. It has still a couple of errors, and what i
think mis-conceptions
(i mostly agree with kristoffer), and i would think that three more
iterations, some deeper
looks and some more discussions would have been a good idea.

However, there seem to be some reasons for the rush, and alltogether,
the tip is far
from being approved. The integration with the core would help to make
things differnt as we did, being an extension. In many respects i would
like
to see a stronger conversion between xotcl and tcl, using objects as core
entities replacing namespaces, or providing better interfaces to
procs/methods
etc, but this does not seem possible on the short range.

I am also not sure, what the TIP means for us, the xotcl core team; or
whether the tcl core
team will start implementing oo::tcl from scratch or mangling the xotcl
code base. Some aspects
of the TIP will change in the implementation process, i would expect an
even stronger
conversion, so it is hard to say what's left for pure xotcl.

It is certainly interesting for us to know, what you like most from the TIP.
maybe it would be a good idea to make an xotcl workshop.

For the time being, we do business as usual, and improve xotcl. i think
we have now
the final version of xotcl 1.3.7, which should be out this week.

Kind regards
-gustaf neumann

Re: [Xotcl] Interested in OO for tcl.

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: Mon, 04 Dec 2006 13:32:44 +0100

mail_at_xdobry.de schrieb:
> For OO-Beginners these XOTcl-Features might be not interesting:
> - method forwarding
> - filters
> - meta classes
> - slots
> - mixins
> - assertions, pre/post condition
> - non positional arguments
> - object aggregation
> I have ordered the features from most advenced to quite practical
> in my opionion.
>
> Although I have written many lines of XOTcl code I have rare used filters (only for debugging and IDE features) and never method forwarding.
> I have also never implemented my own meta class.
> Mixins can be practical to avoid big class hierarchies or in some special object lifecycle scenarios.
> But I need some times to figure out when to use mixins.
> Object aggregation is very usefull.
>

artur,

this is an interesting point of view. I have made often made the
observation
that - given the power of xotcl - beginners tend to "shoot with canons
to sparrots"
(as we se in German). Using all language features for every tiny problem
is not necessarily the best approach.

Your list of what's important is certainly based on your experience and
your needs. It would be interesting to make a little program analyser
for arbitrary scripts, which outputs some basic metrics from
existing programs (starting with LOC, but as well #of classes,
methods, forwards, filters ...). This should
not be very complicated, the basic framework can be implemened
purely with mixins (for proc, instproc, class, superclass, forward,
mixin, ...).
Sounds like a nice weekend project.

-gustaf neumann

Re: [Xotcl] Tcl source requirement

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: Mon, 3 Mar 2003 19:19:16 +0100

On Sunday 02 March 2003 11:15, Kristoffer Lawson wrote:
> Is there any particular reason why XOTcl still requires the Tcl source
> lying around to compile? Generally I find it awkward and not quite "clean"
> that some Tcl extensions require the original Tcl source and I've never
> really needed it myself for my own stuff.

 Dear Kristoffer,

 there is a short answer and a very long answer to your
 question. XOTcl needs the Tcl-source since it contains
 several .h files that are not included in typical binary
 distributions. Such files are tclInt.h or tclCompile.h.
 The first one is sneeking into more distributions
 (a student told me that his SuSE distro includes tclInt.h),
 tclCompile.h was just needed for speed (1.0.2 has
 a better configure script that checks automatically this file).

 The long answer where i am not going into details is, why
 des XOTcl need tclInt.h. In short, XOTcl needs it because
 its needs access to internal of several tcl structures that
 are not public available. Examples are the structures
 Command, Namespace, Interp. Certainly it will be possible
 to define access functions to access the relevant info,
 and we could try to push these into the tcl-source development,
 but we have not started this effort jet. Just comment out
 the include statement of tclInt.h, and you will see how many
 places are involved. We have on our informal todo-list
 a step where we define access macros fort the relevant
 infos, but this is currently not top priority. I agree certainly
 that it would be much nicer to get rid of tclInt.h.

 best regards
-gusaf


-- 
Univ.Prof. Dr.Gustaf Neumann
Abteilung für Wirtschaftsinformatik
WU-Wien, Augasse 2-6, 1090 Wien

Re: [Xotcl] troubleshooting

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

From: Jeff Hobbs <jeffh_at_activestate.com>
Date: Thu, 14 Oct 2010 08:36:56 -0500

The ActiveTcl release is straight from Tcl head of Oct 4 (just after IPv6 went in). The b4 designate just means we've had 4 releases since the first beta, the core version is what the core responds as.

Note that one major change with AT 8.6b4 is that it's x86-x64, not x86-ppc (aka "universal"), so you need the right matching libraries.

Jeff

On 2010-10-14, at 2:29 AM, Gustaf Neumann wrote:

> Dear Victor,
>
> many thanks for the short example! i have compiled xotcl 1.6.6 with
> my three test releases, the script runs fine in every version,
> also valgrind did not report unusual happenings, but i tried
> so far only with mac os x with 64bit.
>
> i am slightly confused about the activestate version number
> TCL 8.6.0.0b4. There was never a version of Tcl 8.6 b4 released
> (or tagged on sourceforge). As you wrote, the tcl_patchLevel
> is 8.6b1.2, which is the current HEAD release (and therefore
> a moving target). Apparently, activestate uses its own tags.
> Have you seen somewhere on activestate a source-release?
>
> -gustaf neumann
>
> On 14.10.10 08:21, Victor Mayevski wrote:
>> Thank you Gustaf,
>> I am using the ActiveState binary and XOTcl is version 1.6.6, not NX. I don't know where to get the source code for TCL 8.6.0.0b4, it is not available anywhere yet.
>>
>> I think I have zeroed in where the crash happens. Here is the sample code that causes the crash for me:
>>
>> tcl_patchLevel 8.6b1.2
>> tcl_platform(byteOrder) = littleEndian
>> tcl_platform(machine) = x86_64
>> tcl_platform(os) = Linux
>> tcl_platform(osVersion) = 2.6.35-22-generic
>> tcl_platform(pathSeparator) = :
>> tcl_platform(platform) = unix
>> tcl_platform(pointerSize) = 4
>> tcl_platform(threaded) = 1
>> tcl_platform(user) = root
>> tcl_platform(wordSize) = 4
>>
>> ####################################
>> Object o
>> Object o::o
>> [o::o info parent] info children
>>
>> Segmentation fault
>> #####################################
>>
>> I have also installed the 32bit version of the same ActiveState binary (the latest one, 8.6.0.0b4, tcl_patchLevel 8.6b1.2) and it will crash right at [package req XOTcl]
>>
>> Hope that helps
>>
>>
>>
>>
>> ----- Original Message -----
>> From: "Gustaf Neumann"<neumann_at_wu-wien.ac.at>
>> To: xotcl_at_alice.wu-wien.ac.at
>> Sent: Wednesday, October 13, 2010 6:56:00 PM GMT -08:00 US/Canada Pacific
>> Subject: Re: [Xotcl] troubleshooting
>>
>> Hi Victor,
>>
>> our typical test setup is to run the regression test with
>> 8.5.9, tcl 8.6b1,
>> and with 8.6head version (where i have applied the
>> SANE-NRE-patch
>> from Miguel). i just double-checked, for me all three test
>> settings
>> work fine.
>>
>> does the regression work on your installation with tcl 8.6b4
>> (run: make test)?
>> If they run fine, and you experience a crash with your
>> application,
>> the following works probably best:
>>
>> Strategy a: try to isolate and pinpoint the problem from the
>> tcl layer
>> by simplifying your script. if the problem can be
>> reproduced with
>> a few lines of code, send it to me.
>>
>> Strategy b: mostly for c-literate developers: use gdb.
>>
>> - compile tcl and nsf with -g enabled (e.g. add it to
>> the compile flags in the Makefile and recompile with
>> "make clean" and "make")
>>
>> - start the tcl shell under gdb, like e.g.
>> gdb /usr/local/src/tcl8.5.9/unix/tclsh
>>
>> - start your application from gdb using
>> run ..../yourapp.tcl
>>
>> - when it crashes, type in
>> where
>> an you will get the backtrace.
>> maybe what you see makes sense to you.
>> if not, send it to me, i'll try me best on it.
>>
>> all the best
>> -gustaf
>>
>> On 14.10.10 00:33, Victor Mayevski wrote:
>>> I have just tried my application on latest TCL 8.6b4 and it crashes (Segmentation fault). The same application works just fine in TCL 8.5.9. Any idea how I can troubleshoot it? Tools, techniques etc?
>>>
>>> Thank you
>>> _______________________________________________
>>> Xotcl mailing list
>>> Xotcl_at_alice.wu-wien.ac.at
>>> http://alice.wu-wien.ac.at/mailman/listinfo/xotcl
>> _______________________________________________
>> Xotcl mailing list
>> Xotcl_at_alice.wu-wien.ac.at
>> http://alice.wu-wien.ac.at/mailman/listinfo/xotcl
>> _______________________________________________
>> Xotcl mailing list
>> Xotcl_at_alice.wu-wien.ac.at
>> http://alice.wu-wien.ac.at/mailman/listinfo/xotcl
>
> _______________________________________________
> Xotcl mailing list
> Xotcl_at_alice.wu-wien.ac.at
> http://alice.wu-wien.ac.at/mailman/listinfo/xotcl

Re: [Xotcl] Send NULL arg to Class constructor

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

From: Ross, Colin <colross_at_CROSSBEAMSYS.COM>
Date: Mon, 27 Apr 2009 20:14:06 -0400

Hi Gustaf - thanks so much for your prompt response. The "instproc configure" is perfect for what I need to do. I do appologise for not being able to find it in the documentation - I guess if you dont know what you are looking for then its difficult to find it.

Thanks again.

Cheers
Colin



-----Original Message-----
From: Gustaf Neumann [mailto:neumann_at_wu-wien.ac.at]
Sent: Mon 4/27/2009 7:24 PM
To: Ross, Colin
Cc: xotcl_at_alice.wu-wien.ac.at
Subject: Re: [Xotcl] Send NULL arg to Class constructor
 
Colin Ross schrieb:
>
> There are potentially 2 ways around this, however, I am unable to find
> information on if either of them are possible:
>
> 1. Allow the passing in of a NULL argument
>
One can call arbitrary methods via configure. You just have just to provide
your own method to handle such a cases, as the default parameter handling
expect always exactly one argument.

==========================
::xotcl::Class Connect -parameter {
    {ssh}
    {ip}
}
Connect instproc telnet {} {
  my set telnet true
}
Connect instproc init {node args} {
  my instvar telnet ip

  # provide a default
  if {![info exists telnet]} {
    set telnet false
  }

  puts telnet=$telnet
  # ....
}

Connect dev node -ip "127.0.0.1" -telnet
==========================

> 1. Prevent the constructor parsing args so that I can parse my own
>
This is as well an option:

==========================
::xotcl::Class Connect

Connect instproc configure args {
  #
  puts stderr "wanna interpret $args"
  #
  # do what ever you want to do with the arguments.....
  #
}
Connect dev node -ip "127.0.0.1" -telnet
==========================


All the best
-gustaf neumann

Re: [Xotcl] new methods, request for comment

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, 24 Apr 2015 09:18:33 +0200

Am 23.04.15 um 19:08 schrieb Victor Mayevski:
>
> nx/xotcl objects require much less memory when these are
> namespace-less
> (contain no children or per-object methods).
>
>
> I am trying to create a generic mechanism for ordered nested objects.
> Although it is true that objects with namespaces use more memory, I
> accept it as a trade off for flexibility I get. I really strive for a
> "natural" order of objects (after all that's what objects are supposed
> to do: be an analog for the real world). I am also trying to make it
> as unobtrusive as possible (without a tracking mechanism etc). The
> reason I wanted timestamps is that I could have naturally named
> objects, when needed.
i did some tests creating large trees (1 mio nodes).

The performance and memory consumption depends on the degree of the tree.
If one creates e.g. a tree of degree 16, then namespaced objects are
actually
the best, since only a small fraction of the nodes (the non-leaf nodes)
have
namespaces. The ordered composite requires some double bookkeeping:
no matter, how the objects are created, these are children of a (maybe
global namespace) and additionally, one has to maintain a list of
the children of the node. It is true that the inner nodes require
more memory, but one saves the extra bookkeeping.

This advantage vanishes when the degree of the tree is low.
For binary tree, half of the nodes have namespaces, ("#ns" below).
Time becomes worse, since in deep trees there are many inner
nodes, which are checked for existence.

If you have huge tree, i would certainly recommend to make
experiments, since the differences can be huge.

-g


Ordered Composite

degree #ns RSS micro secs per obj
   2 0 1130 34.0
  10 0 1010 14.0
  16 0 1010 14.6

Namespaced objects

degree #ns RSS micro secs per obj
   2 500,000 1020 57.7
  10 100,000 725 17.7
  16 62,500 716 15.5

Next Page