From: fips on
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"?

(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
}

It shows a hypothetical operator overloading for "+" in order to
add two complex numbers.
The class is named "Complex" and the object fields "real" and
"image" would contain the data.
Here the object created with the specifier "#auto" is deleted
after the value of the object is passes by "return"

The following code fragement shows similar code for XOTcl:

Complex instproc add { aComplex } {

my instvar real imag
set resultReal [expr { $real + [$aComplex set real] }]
set resultImag [expr { $imag + [$aComplex set imag] }]
Complex result $resultReal $resultImag
}

The problem here with the object "result" is that it is still
there after method conclusion.
Creating the object with the "-volatile" switch does not help,
because then the object is deleted but when
trying to access the object (or the object's value) from the
caller the runtime generates an error.

Any suggestion is really appreciated. Thanks


From: dave.joubert on
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
From: Helmut Giese on
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.

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.
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.
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.

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.
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
<filiberto.silvestri(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"?
>
>(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
> }
>
> It shows a hypothetical operator overloading for "+" in order to
>add two complex numbers.
> The class is named "Complex" and the object fields "real" and
>"image" would contain the data.
> Here the object created with the specifier "#auto" is deleted
>after the value of the object is passes by "return"
>
> The following code fragement shows similar code for XOTcl:
>
> Complex instproc add { aComplex } {
>
> my instvar real imag
> set resultReal [expr { $real + [$aComplex set real] }]
> set resultImag [expr { $imag + [$aComplex set imag] }]
> Complex result $resultReal $resultImag
> }
>
> The problem here with the object "result" is that it is still
>there after method conclusion.
> Creating the object with the "-volatile" switch does not help,
>because then the object is deleted but when
> trying to access the object (or the object's value) from the
>caller the runtime generates an error.
>
>Any suggestion is really appreciated. Thanks
>

From: tom.rmadilo on
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).
From: fips on
On 9 Mrz., 20:55, "dave.joub...(a)googlemail.com"
<dave.joub...(a)googlemail.com> wrote:
> On Mar 9, 5:28 pm, fips <filiberto.silves...(a)hotmail.de> wrote:
>

>
> 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.
>

Yes, thanks for this info. I did not consider in detail all available
OO-extensions. As XOTcl and ITcl are supported by Eclipse plugins
those seemed "mainstream" to me. So I considered these.

>
> > (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.