Bools reloaded

Ivan Senji ivan.senji_REMOVE_ at _THIS__gmail.com
Fri Mar 3 08:15:47 PST 2006


Don Clugston wrote:
>>
>> You should read the latest posts about this stuff (the most with 
>> subject "Re:
>> DMD 0.148 release"). It's all said there. By "pure bools" I mean the 
>> *purist
>> kind* of boolean type. A boolean type that abstracts us from the 
>> implementation.
> 
> 
> Sorry, that's still not clear.
> Bruno is right, terms like "pure bools" or "purist bools" are vague, you 
> can't expect everyone to know what you mean.
> 
> For example: do you want "&" to be legal for bool types, or just "&&"?

Just &&.

> (they mean very different things for integers). "&" normally means 
> "bitwise and", but a pure bool doesn't have any bits.
> Is it legal to cast from a bool to some other type?

I'm not against casting but implicit conversions are bad.

> 
>  > A boolean type that abstracts us from the implementation.
> 
> No abstraction is perfect. Does a bool have a defined bit 
> representation? (If you say 'no' to this, then I don't think a bool 
> could be used in an extern function, you'd always have to convert it to 
> int or something).

I think D ABI should define an internal representation, but it should be 
abstracted from the user, so that the user doesn't have tok know 
anything about it.

You make a good point about passing bool to extern functions, but one 
could argue that even right now you are calling extern functions using 
bools with a couple assumptions in mind. For example that the function 
uses 0==false and true==everything but 0. But that doesn't have to be true.





More information about the Digitalmars-d-announce mailing list