scope and delete are being removed, but not type-safe variadic templates?

2011-01-31 Thread %u
Hi,

I just realized something: If the delete keyword is being removed because it's
dangerous, and if the scope storage class is being removed because of the same
dangling reference problem, how come

int[] global_var;
void foo(int[] args...) { global_var = args; }

isn't considered to be just as dangerous, and therefore also being removed?
(Or perhaps this is a bug, and we should always add the scope modifier so that
it prevents reference escaping?)

Thanks! :)


Re: scope and delete are being removed, but not type-safe variadic templates?

2011-01-31 Thread spir

On 01/31/2011 11:10 AM, %u wrote:

Hi,

I just realized something: If the delete keyword is being removed because it's
dangerous, and if the scope storage class is being removed because of the same
dangling reference problem, how come

 int[] global_var;
 void foo(int[] args...) { global_var = args; }

isn't considered to be just as dangerous, and therefore also being removed?
(Or perhaps this is a bug, and we should always add the scope modifier so that
it prevents reference escaping?)

Thanks! :)


IIRC, I had a bug because of this, precisely (except for obj.member instead of 
global_var).


Denis
--
_
vita es estrany
spir.wikidot.com



Re: scope and delete are being removed, but not type-safe variadic templates?

2011-01-31 Thread Steven Schveighoffer

On Mon, 31 Jan 2011 14:15:18 -0500, spir denis.s...@gmail.com wrote:


On 01/31/2011 11:10 AM, %u wrote:

Hi,

I just realized something: If the delete keyword is being removed  
because it's
dangerous, and if the scope storage class is being removed because of  
the same

dangling reference problem, how come

 int[] global_var;
 void foo(int[] args...) { global_var = args; }

isn't considered to be just as dangerous, and therefore also being  
removed?
(Or perhaps this is a bug, and we should always add the scope modifier  
so that

it prevents reference escaping?)

Thanks! :)


IIRC, I had a bug because of this, precisely (except for obj.member  
instead of global_var).


Yes, I remember that one.

I would say we can't really get rid of it or change the way it works (it's  
just way too awesome to remove).  All we could possibly do ATM is make it  
un-@safe.


Same goes for referencing a stack-allocated fixed-size array:

void foo(int[] args) { global_var = args;}

void bar()
{
int[5] blah;
foo2(blah[]);
}

-Steve