Re: can you return an object from a proc?
- From: "Donal K. Fellows" <donal.k.fellows@xxxxxxxxx>
- Date: Thu, 26 Jun 2008 02:19:01 -0700 (PDT)
googlegro...@xxxxxxxxxxxxxxx wrote:
This is not how most other object oriented languages
operate. They have constructors and destructors. When you
create an object in java, or c++, you are returned
a reference (normally a word sized address) which you
then use to manipulate the object. Tcl does this for
some objects, like opened files or sockets. But other
objects, like yours and like widgets, you have to provide
a unique text string to reference the object, and the
object creation call uses that string to reference the
object, AND creates a command of the same name that you
then use to manipulate the object.
This sort of thing is why many OO systems for Tcl allow you to create
objects with either explicit names or with an automatically-chosen
unique name. (And you know what? Each is the right thing to do in some
cases.) If you can't do that, it's not that hard to implement a system
that uses sequence numbers as part of the names you have to provide.
Donal.
.
- References:
- can you return an object from a proc?
- From: chedderslam
- Re: can you return an object from a proc?
- From: Bryan Oakley
- Re: can you return an object from a proc?
- From: chedderslam
- Re: can you return an object from a proc?
- From: googlegroups
- can you return an object from a proc?
- Prev by Date: Re: Proper usage of the hash-bang line
- Next by Date: Re: Proper usage of the hash-bang line
- Previous by thread: Re: can you return an object from a proc?
- Next by thread: How to print sth during a long proc call?
- Index(es):
Relevant Pages
|