Why isn't bool allowed as AA key type?

KennyTM~ kennytm at gmail.com
Sat May 28 11:29:09 PDT 2011


On May 29, 11 01:54, David Nadlinger wrote:
> Hello all,
>
> is there a reason bool isn't allowed as key type for associative arrays
> (mtype.c:3995)? The docs don't mention this.
>
> bool-key AAs probably wouldn't be too useful in practice, but it seems
> like a quite arbitrary and unexpected limitation to me – e.g. I would
> have to add special cases to all my Thrift map handling code.
>
> In case this is not on purpose, I'd be happy to put together a pull
> request.
>
> David

The limitation is apparently introduced in 0.68* (!), but the changelog 
doesn't show why this is added either. Perhaps it was because at that 
time the type was known as 'bit'. If that's the case, I believe such 
limitation is no longer applicable.

*: 
https://github.com/D-Programming-Language/dmd/commit/42b868c31085211cbb8838325b72d7522f9164d2#L6R1544


More information about the Digitalmars-d mailing list