RE: pass by reference
- Posted by bensler at mail.com Feb 19, 2002
- 472 views
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 > >