Paralysis of analysis

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Dec 14 12:04:17 PST 2010


On 12/14/10 1:56 PM, Kagamin wrote:
> Andrei Alexandrescu Wrote:
>
>> That all being said, I'd like to make a motion that should simplify
>> everyone's life - if only for a bit. I'm thinking of making all
>> containers classes (either final classes or at a minimum classes with
>> only final methods). Currently containers are implemented as structs
>> that are engineered to have reference semantics. Some collections use
>> reference counting to keep track of the memory used.
>
> Thinking about this I've found an interesting issue:
>
> ---
> void foo(int[int] aa)
> {
> 	aa[2]=2;
> }
>
> int main()
> {
> 	int[int] aa;
> 	//aa[1]=1; //uncomment this and it will work
> 	foo(aa);
> 	assert(aa[2]==2);
> 	return 0;
> }
> ---

Yah, this has been discussed many times. Essentially AAs have class-like 
semantics with null in tow.

Andrei


More information about the Digitalmars-d mailing list