Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
January 27, 2003 bit != bool | ||||
---|---|---|---|---|
| ||||
Just to start a discussion IMO bit and bool are not synonymous. 'bit' refers to storage size, whereas 'bool' refers to semantics. 'bit' is more restrictive, and can be used to implement a boolean variable. In relationship with the thread on structs vs. classes: I could imagine that a class has 'bool' variables, which the compiler is free to move around and where the programmer doesn't really care too much if it takes 1 bit or 8 bit (for more efficient access perhaps). 'bit' on the contrary is very specific about this, I would be surprised if my compiler used 8 bits to store my bit... |
January 27, 2003 Re: bit != bool | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jeroen van Bemmel | Jeroen van Bemmel wrote:
> IMO bit and bool are not synonymous. 'bit' refers to storage size, whereas
> 'bool' refers to semantics. 'bit' is more restrictive, and can be used to
> implement a boolean variable.
D's bit has semantics identical to proper bool; it wasn't a misnomer when it was introduced, but it is now. The name should be changed, Walter knows the problem, let's never mention it again.
|
February 09, 2003 Re: bit != bool | ||||
---|---|---|---|---|
| ||||
Posted in reply to Burton Radons | In article <b13pgl$28lp$1@digitaldaemon.com>, Burton Radons says... > >Jeroen van Bemmel wrote: >> IMO bit and bool are not synonymous. 'bit' refers to storage size, whereas 'bool' refers to semantics. 'bit' is more restrictive, and can be used to implement a boolean variable. > >D's bit has semantics identical to proper bool; it wasn't a misnomer when it was introduced, but it is now. The name should be changed, Walter knows the problem, let's never mention it again. > Will the "bit" name ever go away and be replaced by "bool" or "Boolean" or will it be like pre-ISO C99 where everyone invents a new name for Booleans? Once a lot of code gets written one way then the language is almost forced to carry that style forward, example: K&R C idioms like defaulting to int return type had to be allowed in ISO C90, finally dumped in C99. |
February 09, 2003 Re: bit != bool | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mark T | Why? I like the name. It's short. Cubistic. Minimalistic. Doesn't pretent to be more important than it is. And versatile. I don't see why some people can't just get used to calling bool a bit? Why has bit to go away? What would you prefer: to have a bitarray (what it always is), or a boolarray (sometimes a lie)? A bitarray might be a flag array, but it generally needn't. And how about bitstreams vs. boolstreams?
Mark T wrote:
> Will the "bit" name ever go away and be replaced by "bool" or "Boolean" or will
> it be like pre-ISO C99 where everyone invents a new name for Booleans?
>
> Once a lot of code gets written one way then the language is almost forced to
> carry that style forward, example: K&R C idioms like defaulting to int return
> type had to be allowed in ISO C90, finally dumped in C99.
>
|
February 09, 2003 Re: bit != bool | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ilya Minkov | "Ilya Minkov" <midiclub@8ung.at> wrote in message news:b25rbm$2a1v$1@digitaldaemon.com... > Why? I like the name. It's short. Cubistic. Minimalistic. Doesn't pretent to be more important than it is. And versatile. I don't see why some people can't just get used to calling bool a bit? Why has bit to go away? What would you prefer: to have a bitarray (what it always is), or a boolarray (sometimes a lie)? A bitarray might be a flag array, but it generally needn't. And how about bitstreams vs. boolstreams? > bit is storage, bool is semantics; a bool array _might_ be implemented as a bit array, but could be char or int per bool a bit array / stream is bits. bits currently can not be passed by reference, you require a pointer to the byte/int + shift however a bool could be, because it is valid to store a bool in an int to pass to/from func and bit within a local/member. > > Mark T wrote: > > Will the "bit" name ever go away and be replaced by "bool" or "Boolean" or will > > it be like pre-ISO C99 where everyone invents a new name for Booleans? > > > > Once a lot of code gets written one way then the language is almost forced to > > carry that style forward, example: K&R C idioms like defaulting to int return > > type had to be allowed in ISO C90, finally dumped in C99. > > > |
Copyright © 1999-2021 by the D Language Foundation