Re: Boolean Variable Type
- Posted by Everett Williams <rett at GVTC.COM> Feb 18, 2000
- 537 views
Kat wrote: >----- Original Message ----- >From: Lewis Townsend >Subject: Re: Boolean Variable Type > > >> Hello, >> >> >But I'd have to agree that the memory 'wasted' on storing flags in an >> >integer is trivial these days. And I would bet that there would be a >> >performance hit from the need to (internally) mask a bit to determine a >> >boolean value. >> > >> >-- Brian >> >> Wouldn't the space needed to store the memory address >> of the bool have to be a 32 bit value anyway? >> I considdered offering a solution in which you would >> peek and poke to memory to store and retrieve boolean >> values. I then realized that the memory address would >> still have to be stored in a value much greater than >> one bit in size. > >True, but that one 32bit memory addy is the addy for 32 boolean bits, but if >you add one to the addy, you get another 32bits of boolean, which is where >the only payoff is. If there is a payoff, once you count the masking and >such involved. I got too accustomed to bytebool and wordbool tho, for more >fuzzy uses, so i wouldn't use bitbools. Besides, like you said, with 96Meg >of memory, and running a hog OS (any modern OS), throwing 100 bytes at >boolean storage isn't a problem anymore. > >Kat You knew that I couldn't leave this one alone forever. Let's buy the argument that space doesn't matter for now. We'll leave alone the memory needs of generalized speech recognition and generation...let alone semi-intelligent interaction. All the speed and all the space...won't be enough...ever. But, let us move on. However boolean or flag data is stored and handled in the algorithmic side of Euphoria, many times, it will have to be sent and received as flag bytes or bit words. Because of the total inefficiencey of non-aligned byte variables in any kind of modern hardware, most bit containing storage units will be 32 bits, period. We don't have to use all the bits, but that is the unit that they will be stored and retrieved in. Now, if only we could describe the external data efficiently from within Euphoria. I would not mind being forced to convert that structured data to Euphoria native types when doing other than IO, but it would be most useful and efficient to have that transformation be internal to Euphoria. There will never be an automatic way to deal with compression schemes or other items that are truly bitstream oriented, but most other types of external data can be easily broken into a finite, even fairly compact set of data types and therefore builtin conversions. As a matter of fact, we have most of the conversions already as internal functions. With the creation of internal structures, it is a small step to the external structure descriptions that then give us access to the world without peeking and poking everything in sight. Everett L.(Rett) Williams rett at gvtc.com