Prototype of Ownership/Borrowing System for D

Jab jab_293 at
Wed Nov 20 19:14:52 UTC 2019

On Wednesday, 20 November 2019 at 08:19:46 UTC, Walter Bright 
>> Are you really certain there's no way to do this without 
>> adding yet
>> more attributes?
> We'll never be able to compile C-like code if we force an O/B 
> system on all the code. There has to be a way to distinguish, 
> like what `pure` does. D would be unusable if everything had to 
> be `pure`. My understanding of O/B is you're going to have to 
> redesign code and data structures to use it effectively. I.e. 
> it'll break everything. Rust has a powerful enough marketing 
> machine to convince people that redesigning your programs is a 
> Good Thing (tm) and perhaps it is, but we don't have the muscle 
> to do that.

An attribute you put on every function just isn't the greatest. 
If you do fix "@live:" and you can put it at the start of the 
file, then how do you disable it for a section of code you don't 
want it on? This is the problem with @nogc as well and possibly 
some of the other attributes. This leads to every function being 
individually marked as such as needed. This doesn't really add on 
to the problem, but it just introduces a new feature with the 
same problem as those before it. I don't see why this can't just 
be attached to @safe, if this is a feature to prevent memory 
corruption. That's exactly what @safe is for. If your porting C 
code you aren't going to be using @safe anyways. Just as you 
wouldn't be using @live either as you'd effectively have to 
completely rewrite your code.

More information about the Digitalmars-d mailing list