From: fips on
On 9 Mrz., 22:16, Helmut Giese <hgi...(a)ratiosoft.com> wrote:
> Hello,
> just my 0.02.
>
> IncrTcl implements the C++ model of OO. This could mean that people
> coming from other languages (C++, Delphi, Java, C#) run a good chance
> of finding it familiar. For me at least (coming from C++ at the time)
> this was a very attractive feature.
>

Thanks for your detailed answer.
Yes, ITcl is very appealing to those having a strong OO-background in
languages like C++/Java/C#.

> Over the years I have moved over to XOTcl - it's so much more
> powerful. Things are possible which I wouldn't have dreamed of while
> thinking inside the limits/possibilities of C++ (or similar OO
> systems). mixins come to mind - on the class level or for individual
> objects - features like this combined with the dynamic nature of Tcl
> make for phantastic possibilites.

Certainly, XOTcl is more "dynamic" than ITcl. And the question I posed
to myself is: will we ever need all this?
At the moment, "rewriting" a method in a class for bufix purposes is
an issue.

> Of course, as in real life this power has its price: complexity.
> Whenever I started a new (XOTcl based) project I found myself sooner
> or later coming here calling for help - usually with success, though,
> so I do not consider this a show stopper.

Yes, complexity is always a point to consider. The main purpose in
"going OO" is to gain expressive power, not code obfuscation...

> I can think of one scenario where this complexity could present a
> problem: A team of programmers where you have one guru which really
> groks XOTcl, delights in the possibilities it offers, creates
> something fantastic - and then leaves. If you don't have an excellent
> _structural_ documentation of the system the rest of the team may have
> a hard time. This may or may not be a concern for you.

At the momement there is no guru, only programmers :-) But I agree
that code using dynamic features would probably be more complex to
understand if to well documented.

>
> As for your specific questions they don't ring any bell with me:
> 1) Stability: I never had any problem with either of the two - but
> then my systems may have been a lot smaller than what you are doing.
> 2) Inclusion in the core: If you are on a system which is supported by
> ActiveState both are included in the distro.

Sadly, there is no binary distribution that fits exactly our needs,
because we need to be heavily "cross-platform". So taking the sources
and building our own distributions on the various platforms is the
only way to go for us.

> 3) Automatic objects: I don't remember if I ever used them in ITcl and
> I know I never missed it in XOTcl - which should not imply that it is
> not possible there, I just never cared.
>
> Ok, here you go. Best regards
> Helmut Giese
>
> On Tue, 9 Mar 2010 09:28:35 -0800 (PST), fips
>

Ok, thanks.



From: fips on
On 10 Mrz., 01:57, "tom.rmadilo" <tom.rmad...(a)gmail.com> wrote:
> On Mar 9, 11:55 am, "dave.joub...(a)googlemail.com"
>
>
>
> <dave.joub...(a)googlemail.com> wrote:
> > On Mar 9, 5:28 pm, fips <filiberto.silves...(a)hotmail.de> wrote:
>
> > > Hello to all,
>
> > > I am using Tcl in my company. We are planning to use "XOTcl" or "Incr
> > > Tcl" as OO-extension for Tcl. But, at the moment, we do not know which
> > > one to go for.
>
> > > There are still some open questions, maybe someone in this ng is able
> > > to anwer to:
>
> > > (1) stability: I have heard that "Incr Tcl" had some problems with
> > > memory leaks in the past.
> > >      So I wonder if this is still true. Does anybody know if "XOTcl"
> > > has similar problems?
>
> > > (2) proposal for inclusion in Tcl core: "XOTcl" has been proposed for
> > > inclusion in the Tcl core.
> > >      Does anybody know whether there are similar proposals for "Incr
> > > Tcl"?
>
> > In view of the fact that tclOO is 'core', and the latest version of
> > iTcl has been re-written to use this, this is a plus for iTcl.
>
> > > (3) automatic objects:
> > >      In Incr Tcl, objects can be created in a method in a way that the
> > > created object is deleted by the runtime
> > >      after method completion.
> > >      The following code fragement shows an example:
>
> > >       public method + { aComplex } {
>
> > >                 set resultReal [expr { $real + [$aComplex getReal] }]
> > >                 set resultImag [expr { $imag + [$aComplex getImag] }]
> > >                 set result [Complex #auto $resultReal $resultImag]
> > >                 return $result
> > >       }
>
> > Cannot talk about xotcl, but I feel you are gambling here.
> > Normally the create process creates an object and returns the name of
> > the new object.
>
> > Dave
>
> My advice is to look for production code written in each object
> system. I haven't found much ITcl code, but there is a lot of XOTcl
> code. I don't understand either enough to comment, but more working
> production code implies more problems have been worked out and more
> examples exist to explain how the system works.
>
> Both systems have a sound theoretical basis, one from C++ and the
> other from CLOS (Common Lisp Object System).

Yes, I also noticed that there is more XOTcl code available than for
ITcl. I will have a walk through some of this code.
From: stefan on
filiberto,

you might want to take a look at last year's Tcl conference paper on
XOTcl. It provides some overview and many pointers:
http://nm.wu-wien.ac.at/research/publications/b806.pdf

> > > (3) automatic objects:
> > >      In Incr Tcl, objects can be created in a method in a way that the
> > > created object is deleted by the runtime
> > >      after method completion.
> > >      The following code fragement shows an example:
>
> > >       public method + { aComplex } {
>
> > >                 set resultReal [expr { $real + [$aComplex getReal] }]
> > >                 set resultImag [expr { $imag + [$aComplex getImag] }]
> > >                 set result [Complex #auto $resultReal $resultImag]
> > >                 return $result
> > >       }
>
> > Cannot talk about xotcl, but I feel you are gambling here.
> > Normally the create process creates an object and returns the name of
> > the new object.
>
> > Dave
>
> The point is that I would like to create objects in methods without
> creating "garbage". So I looked for a way to do this in XOTcl by I
> haven't succeeded so far. Of course it would be possible to implement
> some garbage collection using naming conventions for the "temporary
> objects" created in methods, but this adds complexity I would like to
> avoid if possible.

in XOTcl jargon, you are looking for "volatile" objects. the volatile
flag
(which is passed to the object creation machinery) binds an object to
a
Tcl proc scope. once a proc scope is left (and the Tcl callframe is
cleared), the
XOTcl object is also "pruned".

see http://media.wu.ac.at/doc/langRef-xotcl.html#Object-volatile

best
//stefan
From: fips on
On 10 Mrz., 10:03, stefan <stefan.sober...(a)wu.ac.at> wrote:
> filiberto,
>
> you might want to take a look at last year's Tcl conference paper on
> XOTcl. It provides some overview and many pointers:http://nm.wu-wien.ac.at/research/publications/b806.pdf
>

Thanks. But the link seems to be broken.

>
> in XOTcl jargon, you are looking for "volatile" objects. the volatile
> flag
> (which is passed to the object creation machinery) binds an object to
> a
> Tcl proc scope. once a proc scope is left (and the Tcl callframe is
> cleared), the
> XOTcl object is also "pruned".
>
> seehttp://media.wu.ac.at/doc/langRef-xotcl.html#Object-volatile
>
> best
> //stefan

Yes, I get a "local" object pruned with "volatile", but I do not
succeed in passing its value to the caller. I seems that in XOTcl
returning an "object" from a method, returns the objects's name. Of
course, if the object is already pruned then, this is pretty
worthless. Accessing the "value" of a locally created object in a
method by using the $-operator also gives an error.

I saw that there are move/copy functions for objects. Maybe using one
of these, would solve the problem. I would need to express things like
"copy the value of this object to the calling object of this method".

I would like to use methods on objects like this:
- set obj1 [obj2 method ?args?]
where the method "method" called on object "obj2" creates an object
that is bound to the caller object "obj1". No objects created in
"method" should exist after the call, and the object created in
"method" (or the object's value) should be passed to the calling
object "obj1".


From: dave.joubert on

> I would like to use methods on objects like this:
> - set obj1 [obj2 method ?args?]
> where the method "method" called on object "obj2" creates an object
> that is bound to the caller object "obj1". No objects created in
> "method" should exist after the call, and the object created in
> "method" (or the object's value) should be passed to the calling
> object "obj1".

The way I do it is when I create the new object within the called
method, is I create it in the caller's frame (or toplevel) not the
called frame.
That solves all my problems. (I use iTcl)

Dave