Re: Pass by address
- Posted by Al Getz <xaxo at AOL.COM> Aug 16, 2000
- 524 views
On passing vars by address: #1 I'm glad someone mentioned this. I've been giving this some thought recently and i see the problem with passing vars in Eu by address is that it then requires complete knowledge of the structure of the data being passed. Worst case, ever try to pass a complex sequence to another exe program? If you like to peek and poke you got it made, but this takes some overhead time, VERY undesirable with a large data structure. One possible way around this could be something like: sequence x global atom x_Address x="this sequence" x_Address=var_base_address("x") --similar to "routine_id()" which of course could return the address of the Eu variable, making it accessable to other parts of a program as well as other programs, but it would have to return the address of the structure (not id), such that another new Eu function in another file or program could use it such as: sequence y use_base_address(y, x_Address) --now y is a sequence whos values are exactly the same as x's, and --modifications made to y are also made to x as well. --x_Address could be passed to other programs too on the command line! If var_base_address{) returns an id instead of an actual address, that will again make passing to another program difficult as with routine_id(). #2 Currently Eu's routine_id() seems to be limited to passing within the same program, so I'd also like to see routine_id() return an address instead of an id. This change would be backward compatible with the current routine_id() as well as to allow passing of routines to other programs! Of course this would make Euphoria plug-ins a reality also. I dont see these changes being much of a challenge for the designers of the Eu language, i'm sure the base addresses are internally available anyway. This wouldnt complicate the language any more then routine_id() did either. Any more ideas on this subject out there? -- Al Getz