I think Associative Array should throw Exception

Steven Schveighoffer schveiguy at gmail.com
Wed Sep 2 14:20:22 UTC 2020


On 9/1/20 10:46 PM, James Blachly wrote:
> On 9/1/20 2:55 PM, Steven Schveighoffer wrote:
>> On 9/1/20 2:20 PM, Jesse Phillips wrote:
>>
>>> Using RangeError is nice as it allows code to use array index inside 
>>> `nothrow.`
>>
>> This is the big sticking point -- code that is nothrow would no longer 
>> be able to use AAs. It makes the idea, unfortunately, a non-starter.
> ....
> 
> Steve, are there not several (probably better, faster) alternatives to 
> the built-in AA that are nothrow? I think a nice way to look at the 
> built-in AA is an easy default for quick scripts, new users, etc., much 
> like the default of `throw` status of a function or code block.
> 
> Advanced users, (i.e. those using nothrow annotation) could select a 
> more efficient AA implementation anyway.

The problem is not the requirement but the resulting code breakage if 
you change it now.

-Steve


More information about the Digitalmars-d-learn mailing list