RE: pass by reference

new topic     » goto parent     » topic index » view thread      » older message » newer message

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.

Kat


On 20 Feb 2002, at 2:23, bensler at mail.com wrote:

> 
> I was one of the people who suggested pass by referencing.
> 
> Here's my thoughts.
> Why on EARTH do I want to type check my variables only to make my 
> program crash 'elegantly', albeit better than the current alternative(no 
> type checks).
> With reference passing, I could type check my variable, and when it's 
> out of bounds, I could modify it, or set it to a default value.
> IMHO, if I'm going to sacrifice some speed to use typechecking in my 
> program, it should be to safeguard my program, not just give a little 
> bit more useful error info.
> 
> You COULD do it with pointers(shudder), but that is a lot of places 
> where you might have to add allocations, deallocations, peeks and pokes. 
> It also means you would have to do double typechecking. First using a 
> generic typecast, and then a secondary typecheck within the routine.
> 
> Bernie Ryan wrote:
> > 
> > I keep reading that you can't use pass by reference
> > in Euphoria. That is not true. You can use pass by
> > reference on any variable or atom or any fixed
> > length structure. The only thing you can't pass by
> > reference is a sequence because it is dynamic and
> > there is no way to control the errors that would
> > be caused by a user. The way you pass by reference
> > is to use allocates, peeks and pokes. 
> > 
> > Bernie
> > 
> > 
> 
> 
>

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu