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

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Wed Jul 3 22:00:39 PDT 2013


On 7/3/13 5:52 PM, Timon Gehr wrote:
> 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?

That it "is the closest type to the bottom of all types" and "subtypes 
many other types as mentioned" :o).

>> 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.

Could be a function call. I find it unnecessary to just add new notation 
for every single little thing.

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

Agreed.


Andrei


More information about the Digitalmars-d mailing list