LRU cache for ~=
Bill Baxter
wbaxter at gmail.com
Mon Oct 19 17:55:35 PDT 2009
On Mon, Oct 19, 2009 at 5:07 PM, Andrei Alexandrescu
<SeeWebsiteForEmail at erdani.org> wrote:
> Rainer Deyke wrote:
>>
>> Andrei Alexandrescu wrote:
>>>
>>> One surprising (but safe) behavior that remains with slices is this:
>>>
>>> void fun(int[] a) {
>>> a[0] = 0;
>>> a ~= 42;
>>> a[0] = 42;
>>> }
>>>
>>> The caller may or may not see 42 in the first slot after the call.
>>
>> Your definition of "safe" is clearly not aligned with mine.
>>
>>
>
> What's yours?
Probably something like "safe from easy-to-write hard-to-debug
programming errors".
I agree that it would stink if all these changes were made and *still*
one of the top gotchas with arrays/slices remained. It also makes me
think slices and appending just don't belong together. Appending to a
view ... just say no.
--bb
More information about the Digitalmars-d
mailing list