RFC: scope and borrowing
via Digitalmars-d
digitalmars-d at puremagic.com
Mon Aug 25 11:03:20 PDT 2014
On Monday, 25 August 2014 at 15:09:32 UTC, bearophile wrote:
> Marc Schütz:
>
>> http://wiki.dlang.org/User:Schuetzm/scope
>
> It looks nice. But perhaps it needs some kind of proof of
> correctness.
Hmm... First there's the assignment rules. They make sure that
nothing with a shorter lifetime ends up in a variable with a
longer lifetime designation. The other part is to proof that the
type deduction and argument matching rules work.
Both parts are not difficult to reason about, but I don't know
what a formal proof needs to look like exactly. (How formal do we
need to go?)
>
> Have you read the old blog posts (written before the creation
> of Rust) by Bartosz Milewski regarding the borrowing in D?
No, can you point me to them? I couldn't find them on his blog
under http://bartoszmilewski.com/category/d-programming-language/
There are some posts about ownership and regions, but only in the
context of multi-threading. I'm afraid this wouldn't easily fit
into a hierarchical system like I have in mind.
>
>
>>Implementation of this feature is possible without doing flow
>>control or interprocedural analysis.<
>
> I remember that Walter has recently said that he's willing to
> add some kind of flow analysis to the D front-end.
Interesting. The question is: is it worth it? Maybe we can
already cover 99% of the use cases with a simpler construct. The
concept needs to be understandable for the users of the language,
too. And maybe "some kind of flow analysis" just isn't enough to
get a significant improvement, maybe it would need whole-program
analysis...
More information about the Digitalmars-d
mailing list