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

Re: [Xotcl] "tie" command

From: Gustaf Neumann <neumann_at_wu-wien.ac.at>
Date: Fri, 24 Jan 2003 17:35:24 +0100

On Friday 24 January 2003 17:03, Kristoffer Lawson wrote:
> On Fri, 24 Jan 2003, Gustaf Neumann wrote:
> > > Oh, I meant to say that an option to [new] is not necessarily the best.
> > > Often (at least in my case) it is a method of an object which creates
> > > an instance and returns it, like:
> > >
> > > set msg [$cmdReader getNewMessage]
> > >
> > > So at the level where I want the automisation I don't directly call
> > > new. Naturally this could be changed to accommodate the use of new, but
> > > then my interface wouldn't be as cleanly split up.
> >
> > i don't get your point: getNewMessage has to create the Object,
> > so it can use certainly new (with all variants). is your argument:
> > the caller of newmessage should decide, whether the created
> > object should be dynamically reclaimed or not?
>
> Yes, obviously getNewMessage will use [new], but it wont be using [new
> -bind] for obvious reasons! The caller is the one that wants to bind it to
> a variable, so yes my argument is that the caller should decide. In fact,
> it could be argued that the same applies to -volatile. That there are
> cases when a new object should be returned by some method other than [new]
> but the caller is generally the one that wants to decide the dynamics of
> the object.

 The caller can certainly do with the object whatever she wants.
 if these are properties needed in the creation method they
 have to be passed somehow there, or the object can be altered,
 or one can put a mechanism on top of the creation to handle this.
 I personally would not have a problem in using two different method
 names for the different cases, like
   set msg [$cmdReader getMessage]
   set msg [$cmdReader getNewMessage]
 or to use an option like in
   set msg [$cmdReader getMessage -volatile]

 i agree, using -bind here with an explicit variable name is not
 syntactically pleasing...

-gustaf

>
> / http://www.fishpool.com/~setok/
>
>
> _______________________________________________
> Xotcl mailing list - Xotcl_at_alice.wu-wien.ac.at
> http://alice.wu-wien.ac.at/mailman/listinfo/xotcl

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