A paper about traps and programming stress

Steven Schveighoffer schveiguy at yahoo.com
Tue Mar 16 14:56:28 PDT 2010


On Tue, 16 Mar 2010 17:33:03 -0400, Andrei Alexandrescu  
<SeeWebsiteForEmail at erdani.org> wrote:

> On 03/16/2010 04:27 PM, Walter Bright wrote:
>> Steven Schveighoffer wrote:
>>> On Tue, 16 Mar 2010 17:18:39 -0400, Walter Bright
>>> <newshound1 at digitalmars.com> wrote:
>>>
>>>> bearophile wrote:
>>>>> Glad to see that the answers I've written for that article aren't
>>>>> useless.
>>>>> But someone else has to file this bug because I am am not expert
>>>>> enough to
>>>>> write it.
>>>>
>>>>
>>>>
>>>> http://d.puremagic.com/issues/show_bug.cgi?id=3977
>>>
>>> Gah, I knew I'd be too late :) Took me a while to find it.
>>>
>>> Marked as a duplicate of
>>> http://d.puremagic.com/issues/show_bug.cgi?id=2095
>>
>> It seems this bug keeps getting rediscovered!
>
> Got my vote. Really needs to be fixed, otherwise we're no better than  
> Java.

Java does a runtime check to ensure you are not saving the wrong type to  
the array.  It's not the best system, but it's is definitely the most  
flexible safe solution.  The proposed solution for D is less flexible,  
because it forces you to treat the objects themselves as const, and not  
modify the contents of the array at all.

So it's really a judgement call on which is better depending on whether  
you value flexibility or performance.

-Steve



More information about the Digitalmars-d mailing list