Re: Frozen sequences
- Posted by Daniel Berstein <daber at PAIR.COM> Jan 28, 1999
- 532 views
<html> At 02:06 a.m. 29-01-99 +0000, you wrote: <br> <font face="Courier New, Courier"><blockquote type=cite cite>I just got this idea, and I want to here some opinions about it. <br> <br> </font><font face="Times New Roman, Times">I understand that one problem with sequences is that they support <br> dynamical memory allocation even when this is not required or <br> even wanted, since it slows down things. <br> <br> What about creating a 'freeze' feature which turns ordinary <br> sequences into variable structures with a fixed size and <br> shape? Eight bytes could be reserved for all atoms in the <br> sequence, to avoid the need for reallocation of memory <br> if for instance an integer turns into floating point. <br> <br> Note that only the structure of the sequnce is frozen, not <br> the values of its atoms, which can be changed as usual. <br> <br> Any attempt to append, prepend or redifine the frozen <br> sequence in any way would result in an error and the program <br> would be terminated. <br> <br> Of course, the sequence could also be unfrozen when <br> dynamic shrinking and growing is required again. <br> <br> Would this speed things up, and if so; how much? </blockquote><br> <br> That's the whole point.<br> <br> What Ralf and others (me included) would like to see is a way to have<br> a static (fixed bounds) data object. This "freezed" sequence is usually<br> called an array on most programming languages. The "unfreeze"<br> funcitonality ain't required (and superflous), because then you get<br> a standard Euphoria sequence. Each element of this freezed sequence<br> can be either an Atom or a Sequence (or a freezed sequence).<br> <br> The namespace is the way the interpreter manages indentifiers (constants,<br> variables, function, types, etc..) and how they get in/out of scope.<br> Currently Euphoria namespace is very limited: your identifiers are<br> confined to the routine/include they are defined or are global to the whole<br> application. In large proyects this guarantees name conflict.<br> <br> </font> <BR> <div>Regards,</div> Berstein</div> </html>