[:] as empty associative array literal, plus warning for null

Timon Gehr timon.gehr at gmx.ch
Wed Jul 3 17:52:12 PDT 2013


On 07/04/2013 02:28 AM, Andrei Alexandrescu wrote:
> On 7/3/13 10:31 AM, Dicebot wrote:
>> On Wednesday, 3 July 2013 at 16:55:59 UTC, bearophile wrote:
>>> ...
>>
>> Has sounded convincing enough for me. Anything that enforces stronger
>> typing is big win in my opinion.
>
> typeof(null) has quite a few interesting properties. It's the closest
> type to the bottom of all types (we don't have an actual bottom type),
> and it subtypes many other types as mentioned.
>
> Introducing yet another type works against that nice uniformity

What is that nice uniformity?

> and is yet another arbitrary little thing that people who learn the language
> would need to know about.
>...

A lot less arbitrary than having to initialize AAs into an empty state 
by adding and removing a mapping.

Also, I think [] should have a singleton type as well. Currently it is a 
void[] with special implicit conversion rules.


More information about the Digitalmars-d mailing list