Accessing static data of functions

Imperatorn johan_forsberg_86 at hotmail.com
Tue Oct 19 17:28:33 UTC 2021


On Tuesday, 19 October 2021 at 17:08:41 UTC, Imperatorn wrote:
> On Tuesday, 19 October 2021 at 17:04:32 UTC, Timon Gehr wrote:
>> On 19.10.21 18:43, Imperatorn wrote:
>>> [...]
>>
>> This is about static variables at function scope. Java does 
>> not have static variables at function scope.
>>
>> string uniqueName(){
>>     static int id = 0; // this is the value that OP wants to 
>> preserve on reload
>>     return text("__tmp", id++);
>> }
>
> Ok, I know nothing about Java other than D got some inspiration 
> from it. What I do know is C#.

Well, ok, I know *some* things. Wrote some mobile Java apps but 
that's about it.


More information about the Digitalmars-d mailing list