const as default for variables

Sönke Ludwig via Digitalmars-d digitalmars-d at puremagic.com
Sun Mar 15 15:48:18 PDT 2015


Am 15.03.2015 um 15:16 schrieb "Marc =?UTF-8?B?U2Now7x0eiI=?= 
<schuetzm at gmx.net>":
> On Sunday, 15 March 2015 at 13:21:11 UTC, Sönke Ludwig wrote:
>> My proposal would be to make "scope" (with strong recursive
>> guarantees) the default instead to achieve that goal. That would give
>> the compiler a lot of optimization potential (much more than just for
>> RC), and would at the same time most probably be a lot less limiting.
>> It would also be a nice documentation trait to see where references
>> are stored for later use. And it could even be used to implement
>> checked safety for calling C/C++ functions with GC references.
>
> Please see my newest scope proposal, which I just posted here:
> http://forum.dlang.org/thread/tlupkiiarrabqaxtayci@forum.dlang.org#post-tlupkiiarrabqaxtayci:40forum.dlang.org
>
>
> It does almost what you suggest, but only for @safe functions, to avoid
> breaking too many things. A change à la "@safe by default" would then
> have the same effect.

My idea was to make the change explicit first, but module wide (e.g. 
using a pragma or similar), so that there is no immediate breakage at 
all. Only the last stage of the deprecation plan would finally switch 
over the defaults for unannotated modules.

I'll make sure to have a look at the proposal later!


More information about the Digitalmars-d mailing list