Re: Euphoria 2.5 Features..... ??
- Posted by "Igor Kachan" <kinz at peterlink.ru> Dec 09, 2003
- 624 views
Hello Al, ---------- > From: Al Getz <Xaxo at aol.com> > Subject: RE: Euphoria 2.5 Features..... ?? > > Hello there Igor, > > First off, that algorithm probably doesnt work for sequences > that dont have lengths that are multiples of 4. Yes, I was just in a hurry to &= {0} or {0,0} or {0,0,0} to the not/4 texts, it is a clear thing for me. > It's a neat idea thoughThanks. > Second, why would you want to go through all that trouble > when you can use allocate_text()/free() pairs to manage > the storage of text if you are THAT worried about the > waste of memory due to character sequence storage ? These allocate_text()/free() pairs are the low-level stuff, C-like stuff, and I am not *too* worried in this case. But why not to use an atom as just a sequence of bytes? It is some artificial trick for Euphoria, but EU atoms have the elementary particles too, same as real atoms. If you need the particles - get them just now - this is EU. But do you see - this need becomes really actual just sometimes? As some extra feature? The Euphoria language has an incredible flexibility. And with front- and back-end this incredible flexibility may be fantastic one, I think. > Take care, > Al Good luck! Regards, Igor Kachan kinz at peterlink.ru > Igor Kachan wrote: > > > > > > Hello Mario again, > > > > ---------- > > > From: Mario Steele <eumario at trilake.net> > > > To: EUforum at topica.com > > > Subject: Euphoria 2.5 Features..... ?? > > > Sent: 5 dec 2003 y. 15:37 > > > > > > > > > Hello all, I'm back! > > > > > > Allright, wanted to pass along a couple of ideas, and maybe run over a > > > idea like a rampid person, that tries to wear something out. And I do > > > seriously think these would be good Ideas for Euphoria 2.5 > > > > > > First off, The wearing out Idea/Problem. A String Type Variable. > > > Yeah Yeah, I realize we can do custom string type variables in Euphoria, > > > > > > but there's still 1 major problem with it all. Even if it's a string > > > type variable, Euphoria still allocates 4 bytes of memory to store a > > > simple 0 to 255 (Or 0 to 255*2) character into memory. Now for little > > > baby strings, okay, that's kewl, no big loss. But when we get into big > > > files, like for example, Win32lib _BEFORE_ the breakup into seperate > > > libraries, and still somewhat now, we get a very big memory waste for > > > all of it. Now we all know, the interpreter doesn't allocate 4 bytes of > > > > > > memory for each character, when reading the Plain Text euphoria code > > > into memory, for parsing, and execution. So my quesiton is, why should > > > we have to waste memory to read a file into memory, especially big > > > files, which could double, even triple in size, when loaded into a > > > simple Euphoria Sequence. > > > > [[snipped the solved problem]] > > > > I do not know if someone used the trick below, > > but it seems to be useful for some new > > text routines of Euphoria without > > new char type. > > > > --- code > > include machine.e > > > > sequence text > > > > text = "test of packing the text into the atoms " > > > > ? text > > > > puts(1,text) > > > > puts(1, "\n----- chars (integers) - ") > > ? length(text) > > puts(1, "\n\n\n\n") > > > > sequence TEXT TEXT = {} > > > > for i=1 to length(text) by 4 do > > TEXT &= bytes_to_int(text[i..i+3]) > > end for > > > > ? TEXT > > > > for i=1 to length(TEXT) do > > puts(1,int_to_bytes(TEXT[i])) > > end for > > > > puts(1, "\n----- atoms - ") > > ? length(TEXT) > > --- end of code > > > > Try please, maybe it is not too bad ...