Re: RE: pass by reference
On 20 Feb 2002, at 16:36, Derek Parnell wrote:
>
> 20/02/2002 2:21:46 PM, Kat <gertie at PELL.NET> wrote:
>
> >
> >Wouldn't the PassByReference camp be satisfied with a table of the vars?
> >And maybe a table of the functions, like routine_id()s for everything? I have
> >a
> > feeling this already exists in Eu, but we don't have access to it. Then,
> > with
> >exception handling, you could check whatever vars you wanted, and do whatever
> >you need to do with them.
> >
>
> I can see where you are going here. Something like variable_id() that would
> return a reference to the variable. This idea seems nice but it also creates
> other side-effects. For example, what exactly would it return? Currently
> routine_id() returns an integer. If variable_id() returned an integer, how
> would
> we distinguish between an integer and a data reference in the routine it was
> passed to.
With the perfect variable package: the nested sequence!
Vars have 3 things we are interested in:
1) the var name
2) the var type
3) the var's contents (yes!)
maybe the location of the var in memory would be a bad thing, all things
considered.
So, pass a nested sequence of {s name , s type}, so one could do:
s = getvar(1) -- s = {"data","s"}
i = getvar(0)) -- how many vars?
while loop = 1 to getvars(0) do
if equal(getvar(loop)[2],"s") -- not "ns"!
then puts(1,getvar(loop)[1] )
end if
end while
This might be nice:
if accessed(varname) then
run some method on it here
end if
Kat
|
Not Categorized, Please Help
|
|