@live questions

Max Haughton maxhaton at gmail.com
Sun Nov 22 03:28:49 UTC 2020

On Sunday, 22 November 2020 at 02:28:20 UTC, Dibyendu Majumdar 
> Hi
> I don't quite know Rust so it is bit hard to compare this 
> feature with Rust. Ideally someone who knows both languages in 
> depth should compare and figure out if @live is comparable to 
> Rust ownership ideas.
> I have following questions / suggestions:
> a) I understand on its own @live is only part of what Rust 
> does? Rust has lifetime annotations and I believe it can track 
> memory allocation across a graph of objects and ensure there is 
> no leak etc. Is my understanding correct that @live only deals 
> with pointers and to compare this to Rust, one has to also 
> include DIP1000?
> My first suggestion is that @live and DIP1000 features should 
> be documented together. I heard in the discussions that DIP1000 
> is actually not yet documented?
> b) Is it also the case that DIP1000 is only available if a 
> function is marked @safe?
> It seems to me that both @live and @safe should be available as 
> compiler flags to turn them on - and not have to rely on 
> annotations. Is this possible? Certainly in Laser-D I would 
> like these to be ON by default and annotation should be to 
> suppress rather than enable.

a) Current measures are indeed not as thorough as rust's.

b) No. If you want to implement the switch you can but it would 
not only break a lot of code (live is not ready for prime time 
for example) but immediately fragment the language.

The memory safety features are not properly documented but the 
specification is not without mention of them, but in general the 
language is woefully underspecified.

More information about the Digitalmars-d mailing list