On Wed, Nov 11, 2009 at 1:36 PM, Andrei Alexandrescu <seewebsiteforem...@erdani.org> wrote: > Bill Baxter wrote: >> >> On Wed, Nov 11, 2009 at 1:16 PM, Andrei Alexandrescu >> <seewebsiteforem...@erdani.org> wrote: >> >>> One option that hasn't been mentioned: >>> >>> private ref int myInt() { >>> static int theInt; >>> return theInt; >>> } >>> >>> void fun(T)(T arg) { >>> ... use myInt() ... >>> } >> >> Is that a joke? That just replaces global symbol theInt with global >> symbol myInt. I don't see the win. >> >> --bb > > Forgot to mention that the function gives you the opportunity to initialize > the object in the general case.
Ah, ok. I thought you were proposing that as another way to limit the scope of the variable. --bb