[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ns] Why bind variables ?



On Fri, 4 May 2001, Haobo Yu wrote:


> Seems to me bound variables are a conceptually beautiful way to manipulate
> variables in the way that the language intends. Bullet (2) saves you extra
> memory that is used for the bound variables (since you need to instantiate
> it as a tcl variable), but in otcl space you can only manipulate a
> _copy_ of the variable (i.e., its value) but not the shadow of the c++
> variable itself. One example might be using upvar.
>
> However, I don't remember seeing any such examples in the ns tcl code, and
> I like to use (2) a lot because of the memory overhead of (1).
>
> - Haobo
>
> > 1) in what cases should i define the same variable in
> > OTCl and C++ and use the "bind" function ?
> >

OTOH method 1 might be useful in cases where the variable is dynamic
(value changes thruout the simulation) and needs to be updated both in OTcl and
C++. a good example might be TCP parameters.

--Padma

> > 2) in what other cases it's better to pass that
> > parameter from OTCl to C++ (and viceversa) putting it
> > as a function parameter ?
> >
> > Thanks a lot,
> >                Andrea.
> >
> >
> > ______________________________________________________________________
> > Do You Yahoo!?
> > Il tuo indirizzo gratis e per sempre @yahoo.it su http://mail.yahoo.it
> >
> >
>

-- 
------------------------------------------------
Be true to your work, your word, and your friend.
--Thoreau

Padmaparna Haldar