Re: Structure Pre-Processor
- Posted by Ralf Nieuwenhuijsen <nieuwen at XS4ALL.NL> Feb 18, 1999
- 429 views
>Hello structure fans, > >Here's a little something I cooked up this morning to hack structures >into Euphoria. See program comments for details. Enjoy! Interesting approach. This way we do have the speed benefit, that comes with structures. You say 'scope not enforced', but the scope is already enforced by Euphoria. The only real 'issue' that I can find is that we are not able to express the whole structure or parts of it. But this can be solved as well, I think. I see three options: 1) When we use the whole structure, just built it up: { my_structure_item1, my_structure_item2 } Note: WHen we assign something to it, we would need to use some dummy variable. However, this is *slow* 2) Always keep the decleration of a variable (using a structure) global. And have a little function to retrieve and set the structure. 3) Use at least one level of slicing. That is, structures in structures, etc. are automatically resolved, only the first-top-level of the structure is a sequence. Maybe a little database managed by an external library. Faster than the above options. Esspecially since the slicing could be partly 'optimized' away, by efficiently lookup and store values in the sequence, only when needed. Oh, and why cant we use structures in a routine ? I mean, without passing it around, we should be able to use them in a routine, or am I missing something here ? Anyways... nice work. Ralf