DConf 2019 AGM Livestream

Nick Sabalausky (Abscissa) SeeWebsiteToContactMe at semitwist.com
Sun May 12 05:13:36 UTC 2019


On 5/11/19 10:27 PM, Mike Franklin wrote:
> On Saturday, 11 May 2019 at 20:35:40 UTC, Exil wrote:
> 
>> Regarding the discussion of how bool is handled...
>>
>>> It's a one bit integer so it should behave like a one bit integer
>> https://www.youtube.com/watch?v=cpTAtiboIDs#t=2h17m50s
> 
> I think Walter is conflating how bool is stored in memory with its 
> semantics.

I find this tends to be an unfortunately *very easy* trap to fall into 
for programmers highly-experienced in low-level work: the conflation of 
abstraction vs implementation. This conflation is something they're more 
accustomed to, more comfortable with, and more tolerant of, than other 
programmers.

The real key here is this:

Do we have 'bool' because a 1-bit integer is useful, or do we have 
'bool' because a "true vs false" abstraction is useful?

The answer to that dictates the correct semantics.

> I'm currently considering using D's rich modeling features 
> to create a new boolean type that behaves more like a boolean and less 
> like a bit.  But it's unfortunate and disappointing we have to resort to 
> something like that.

Please do! Way I figure, it'll either work great and be a fantastic tool 
to have, or at the very *worst*, if there turns out to be any downsides 
to using it (vs a well-made built-in bool), then it will still serve to 
help root out any areas where D can improve its in-library modeling 
capabilities.


More information about the Digitalmars-d-announce mailing list