Why is this allowed

Steven Schveighoffer schveiguy at gmail.com
Tue Jun 30 18:35:22 UTC 2020


On 6/30/20 2:22 PM, H. S. Teoh wrote:
> On Tue, Jun 30, 2020 at 02:06:13PM -0400, Steven Schveighoffer via Digitalmars-d-learn wrote:
>> On 6/30/20 12:37 PM, Steven Schveighoffer wrote:
> [...]
>> I take it back, I didn't realize this wasn't something that happened
>> with dynamic arrays:
>>
>> int[] dyn = [1, 2, 3];
>>
>> dyn = 5; // error
>> dyn[] = 5; // ok, brackets required
>>
>> I would say that's a decent precedent to deprecate and remove that
>> functionality.
> [...]
> 
> Could you add this info to the bugzilla issue as additional evidence
> that this (mis)feature should be removed?
> 
> 	https://issues.dlang.org/show_bug.cgi?id=15932

That's a different issue. In the case of:

staticarr = 5;

There is no issue with lifetime management or memory safety. It's 
possible that fixing 15932 would fix this issue too, but it's possible 
that's not true (we are assuming it's the implicit cast that is causing 
this issue, but it might be separately implemented).

-Steve


More information about the Digitalmars-d-learn mailing list